新增 SaCheckOr 注解,批量注解鉴权:只要满足其中一个注解即可通过验证

This commit is contained in:
click33
2023-05-23 05:01:16 +08:00
parent 4496242626
commit 4cf317818b
25 changed files with 241 additions and 45 deletions

View File

@@ -45,7 +45,7 @@ public class SaTokenDaoOfRedisJson implements SaTokenDao {
redisBucket = redisClient.getBucket();
// 重写 SaSession 生成策略
SaStrategy.me.createSession = (sessionId) -> new SaSessionForJson(sessionId);
SaStrategy.instance.createSession = (sessionId) -> new SaSessionForJson(sessionId);
}

View File

@@ -181,12 +181,12 @@ public class SaTokenFilter implements SaFilter, Filter { //之所以改名,为
Method method = action.method().getMethod();
// 如果此 Method 或其所属 Class 标注了 @SaIgnore则忽略掉鉴权
if (SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
if (SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
return false;
}
// 注解校验
SaStrategy.me.checkMethodAnnotation.accept(method);
SaStrategy.instance.checkMethodAnnotation.accept(method);
}
return true;

View File

@@ -230,12 +230,12 @@ public class SaTokenInterceptor implements RouterInterceptor {
Method method = action.method().getMethod();
// 如果此 Method 或其所属 Class 标注了 @SaIgnore则忽略掉鉴权
if (SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
if (SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
return false;
}
// 注解校验
SaStrategy.me.checkMethodAnnotation.accept(method);
SaStrategy.instance.checkMethodAnnotation.accept(method);
}
return true;