新增:回传文件到本地磁盘

This commit is contained in:
yangyang01000846
2025-12-05 15:33:21 +08:00
parent 73a65215e8
commit 412fe873bc
12 changed files with 68 additions and 12 deletions

View File

@@ -1,24 +1,30 @@
package com.sdm.pbs.filter;
import com.sdm.common.common.ThreadLocalContext;
//import com.sdm.pbs.service.UserService;
import com.sdm.common.config.WhitelistProperties;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.AntPathMatcher;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
@Slf4j
public class AuthFilter implements Filter {
// @Resource
// private UserService userService;
@Autowired
private WhitelistProperties whitelistProperties;
private List<String> excludedPaths;
private final AntPathMatcher pathMatcher = new AntPathMatcher();
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Filter.super.init(filterConfig);
// 从初始化参数中读取白名单
excludedPaths = whitelistProperties.getPaths();
log.info("----------- AuthFilter init ----------");
}
@@ -26,6 +32,14 @@ public class AuthFilter implements Filter {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
if (servletRequest instanceof HttpServletRequest) {
HttpServletRequest req = (HttpServletRequest) servletRequest;
String path = req.getRequestURI().substring(req.getContextPath().length());
// 检查当前请求是否在白名单中
for (String excludedPath : excludedPaths) {
if (pathMatcher.match(excludedPath, path)) {
filterChain.doFilter(servletRequest, servletResponse);
return;
}
}
if(!ThreadLocalContext.verifyRequest(req))
{
HttpServletResponse response = (HttpServletResponse) servletResponse;

View File

@@ -131,4 +131,9 @@ pbs:
task:
hpc: hpc
qusb: qusb
impl: hpc
impl: hpc
security:
whitelist:
paths:
- /pbs/jobFileCallback