mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-02-27 16:50:24 +08:00
!238 sa-token-solon-plugin: 优化集成处理逻辑
Merge pull request !238 from 西东/dev
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
package cn.dev33.satoken.solon;
|
||||
|
||||
import cn.dev33.satoken.solon.oauth2.SaOAuth2AutoConfigure;
|
||||
import cn.dev33.satoken.solon.sso.SaSsoAutoConfigure;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.core.AopContext;
|
||||
import org.noear.solon.core.Plugin;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.basic.SaBasicTemplate;
|
||||
import cn.dev33.satoken.basic.SaBasicUtil;
|
||||
@@ -19,10 +13,15 @@ import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.solon.model.SaContextForSolon;
|
||||
import cn.dev33.satoken.solon.oauth2.SaOAuth2AutoConfigure;
|
||||
import cn.dev33.satoken.solon.sso.SaSsoAutoConfigure;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.temp.SaTempInterface;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.core.AopContext;
|
||||
import org.noear.solon.core.Plugin;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
|
||||
@@ -180,9 +180,10 @@ public class SaTokenFilter implements Filter { //之所以改名,为了跟 SaT
|
||||
beforeAuth.run(mainHandler);
|
||||
}
|
||||
//2.执行注解处理
|
||||
authAnno(action);
|
||||
//3.执行规则处理
|
||||
auth.run(mainHandler);
|
||||
if(authAnno(action)) {
|
||||
//3.执行规则处理(如果没有被 @SaIgnore 忽略)
|
||||
auth.run(mainHandler);
|
||||
}
|
||||
});
|
||||
} catch (StopMatchException e) {
|
||||
|
||||
@@ -206,7 +207,7 @@ public class SaTokenFilter implements Filter { //之所以改名,为了跟 SaT
|
||||
chain.doFilter(ctx);
|
||||
}
|
||||
|
||||
private void authAnno(Action action) {
|
||||
private boolean authAnno(Action action) {
|
||||
//2.验证注解处理
|
||||
if (isAnnotation && action != null) {
|
||||
// 获取此请求对应的 Method 处理函数
|
||||
@@ -214,11 +215,13 @@ public class SaTokenFilter implements Filter { //之所以改名,为了跟 SaT
|
||||
|
||||
// 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
|
||||
if (SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 注解校验
|
||||
SaStrategy.me.checkMethodAnnotation.accept(method);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,9 +179,10 @@ public class SaTokenInterceptor implements RouterInterceptor {
|
||||
beforeAuth.run(mainHandler);
|
||||
}
|
||||
//2.执行注解处理
|
||||
authAnno(action);
|
||||
//3.执行规则处理
|
||||
auth.run(mainHandler);
|
||||
if(authAnno(action)) {
|
||||
//3.执行规则处理(如果没有被 @SaIgnore 忽略)
|
||||
auth.run(mainHandler);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (StopMatchException e) {
|
||||
@@ -206,7 +207,7 @@ public class SaTokenInterceptor implements RouterInterceptor {
|
||||
chain.doIntercept(ctx, mainHandler);
|
||||
}
|
||||
|
||||
private void authAnno(Action action) {
|
||||
private boolean authAnno(Action action) {
|
||||
//2.验证注解处理
|
||||
if (isAnnotation && action != null) {
|
||||
// 获取此请求对应的 Method 处理函数
|
||||
@@ -214,11 +215,13 @@ public class SaTokenInterceptor implements RouterInterceptor {
|
||||
|
||||
// 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
|
||||
if (SaStrategy.me.isAnnotationPresent.apply(method, SaIgnore.class)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 注解校验
|
||||
SaStrategy.me.checkMethodAnnotation.accept(method);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user