!144 代码合并

Merge pull request !144 from MAC/develop
This commit is contained in:
MAC 2023-05-09 11:40:33 +00:00 committed by Gitee
commit 56c8665c3e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -11,6 +11,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
@ -41,10 +42,17 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
"/notice/list",
"/notice/detail",
"/param/grouplist",
"/error/**",
"/swagger-ui.html",
"/office/IndexServlet"
};
private String[] antWhiteUri = {"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/swagger-ui/**",
"/webSocket/**",
"/error/**",};
@Autowired
private UserService userService;
@Resource
@ -60,6 +68,14 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
if (!qiwenVersion.equals(version)) {
throw new QiwenException(999999, "脚本未初始化,请在数据库执行数据初始化脚本,存放路径: '/resources/import.sql'");
}
List<String> antWhiteUriList = Arrays.asList(antWhiteUri);
for (String antWhiteUri : antWhiteUriList) {
AntPathRequestMatcher regexRequestMatcher = new AntPathRequestMatcher(antWhiteUri, "GET", true);
if (regexRequestMatcher.matches(request)) {
chain.doFilter(request, response);
return;
}
}
List<String> ignoreUriList = Arrays.asList(ignoreUri);
if (ignoreUriList.contains(request.getRequestURI())) {