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