mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 01:58:05 +08:00
新增 SaCheckOr 注解,批量注解鉴权:只要满足其中一个注解即可通过验证
This commit is contained in:
@@ -25,7 +25,7 @@ import com.jfinal.aop.Invocation;
|
||||
public class SaAnnotationInterceptor implements Interceptor {
|
||||
@Override
|
||||
public void intercept(Invocation invocation) {
|
||||
SaStrategy.me.checkMethodAnnotation.accept((invocation.getMethod()));
|
||||
SaStrategy.instance.checkMethodAnnotation.accept((invocation.getMethod()));
|
||||
invocation.invoke();
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ import com.jfinal.aop.Invocation;
|
||||
public class SaAnnotationInterceptor implements Interceptor {
|
||||
@Override
|
||||
public void intercept(Invocation invocation) {
|
||||
SaStrategy.me.checkMethodAnnotation.accept((invocation.getMethod()));
|
||||
SaStrategy.instance.checkMethodAnnotation.accept((invocation.getMethod()));
|
||||
invocation.invoke();
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -100,13 +100,13 @@ public class SaInterceptor implements HandlerInterceptor {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
|
||||
// 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
|
||||
if(SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
if(SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
// 注意这里直接就退出整个鉴权了,最底部的 auth.run() 路由拦截鉴权也被跳出了
|
||||
return true;
|
||||
}
|
||||
|
||||
// 执行注解鉴权
|
||||
SaStrategy.me.checkMethodAnnotation.accept(method);
|
||||
SaStrategy.instance.checkMethodAnnotation.accept(method);
|
||||
}
|
||||
|
||||
// Auth 路由拦截鉴权校验
|
||||
|
@@ -101,13 +101,13 @@ public class SaInterceptor implements HandlerInterceptor {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
|
||||
// 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
|
||||
if(SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
if(SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
// 注意这里直接就退出整个鉴权了,最底部的 auth.run() 路由拦截鉴权也被跳出了
|
||||
return true;
|
||||
}
|
||||
|
||||
// 注解校验
|
||||
SaStrategy.me.checkMethodAnnotation.accept(method);
|
||||
SaStrategy.instance.checkMethodAnnotation.accept(method);
|
||||
}
|
||||
|
||||
// Auth 校验
|
||||
|
Reference in New Issue
Block a user