突然设置的登录url失效,访问返回404错误
@Slf4j
public class GithubLoginAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
protected GithubLoginAuthenticationFilter(String defaultFilterProcessesUrl) {
super(defaultFilterProcessesUrl);
}
protected GithubLoginAuthenticationFilter(RequestMatcher requiresAuthenticationRequestMatcher) {
super(requiresAuthenticationRequestMatcher);
}
public GithubLoginAuthenticationFilter() {
super(new AntPathRequestMatcher("/auth2/receive", "GET"));
}
原因:因为偷懒把权限 /auth2/** 路径设置到静态访问目录,导致直接访问到template-loader-path目录去了,不会进AbstractAuthenticationProcessingFilter过滤器,所以导致404。(没来得及看源码,后面补上)
# 放行静态资源 web.static.filtrate=/js/**,/css/**,/images/**,/fonts/**,/lib/**,/authority_error,/favicon.ico,/**.ico,/error,/api/v1/**, /auth2/**
解决方法:
把 /auth2/** 设置到匿名用户组里去 ROLE_ANONYMOUS 。