将全局过滤器的 BeforeAuth 认证设为不受 includeList 与 excludeList 的限制,所有请求都会进入

This commit is contained in:
noear 2023-05-01 09:37:50 +08:00
parent 3a84c3d51e
commit 68e99f232e
2 changed files with 8 additions and 7 deletions

View File

@ -123,11 +123,12 @@ public class SaTokenFilter implements SaFilter, Filter { //之所以改名,为
Handler mainHandler = Solon.app().router().matchMain(ctx);
Action action = (mainHandler instanceof Action ? (Action) mainHandler : null);
//先路径过滤下包括了静态文件
//1.执行前置处理主要是一些跨域之类的
if(beforeAuth != null) {
beforeAuth.run(mainHandler);
}
//先路径过滤下包括了静态文件
SaRouter.match(includeList).notMatch(excludeList).check(r -> {
//2.执行注解处理
if(authAnno(action)) {

View File

@ -172,19 +172,19 @@ public class SaTokenInterceptor implements RouterInterceptor {
try {
Action action = (mainHandler instanceof Action ? (Action) mainHandler : null);
//先路径过滤下包括了静态文件
//1.执行前置处理主要是一些跨域之类的
if(beforeAuth != null) {
beforeAuth.run(mainHandler);
}
//先路径过滤下不包括静态文件
SaRouter.match(includeList).notMatch(excludeList).check(r -> {
//1.执行前置处理主要是一些跨域之类的
if(beforeAuth != null) {
beforeAuth.run(mainHandler);
}
//2.执行注解处理
if(authAnno(action)) {
//3.执行规则处理如果没有被 @SaIgnore 忽略
auth.run(mainHandler);
}
});
} catch (StopMatchException e) {
} catch (SaTokenException e) {