mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 18:22:15 +08:00
废弃 SaTokenAction 接口,新增 SaStrategy 策略类
This commit is contained in:
@@ -5,7 +5,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.util.PathMatcher;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.action.SaTokenAction;
|
||||
import cn.dev33.satoken.basic.SaBasicTemplate;
|
||||
import cn.dev33.satoken.basic.SaBasicUtil;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
@@ -63,7 +62,7 @@ public class SaBeanInject {
|
||||
* @param saTokenAction SaTokenAction对象
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setSaTokenAction(SaTokenAction saTokenAction) {
|
||||
public void setSaTokenAction(@SuppressWarnings("deprecation") cn.dev33.satoken.action.SaTokenAction saTokenAction) {
|
||||
SaManager.setSaTokenAction(saTokenAction);
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import cn.dev33.satoken.temp.SaTempInterface;
|
||||
* @author noear
|
||||
* @since 1.4
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class XPluginImp implements Plugin {
|
||||
|
||||
@Override
|
||||
|
@@ -1,9 +1,10 @@
|
||||
package cn.dev33.satoken.solon.integration;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import org.noear.solon.core.aspect.Interceptor;
|
||||
import org.noear.solon.core.aspect.Invocation;
|
||||
|
||||
import cn.dev33.satoken.strategy.SaStrategy;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
* @since 1.4
|
||||
@@ -14,8 +15,8 @@ public class SaTokenMethodInterceptor implements Interceptor {
|
||||
|
||||
@Override
|
||||
public Object doIntercept(Invocation inv) throws Throwable {
|
||||
// 注解鉴权
|
||||
SaManager.getSaTokenAction().checkMethodAnnotation(inv.method().getMethod());
|
||||
// 注解鉴权
|
||||
SaStrategy.me.checkMethodAnnotation.accept(inv.method().getMethod());
|
||||
|
||||
// 执行原有逻辑
|
||||
return inv.invoke();
|
||||
|
@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.strategy.SaStrategy;
|
||||
|
||||
/**
|
||||
* 注解式鉴权 - 拦截器
|
||||
@@ -37,7 +37,7 @@ public class SaAnnotationInterceptor implements HandlerInterceptor {
|
||||
Method method = ((HandlerMethod) handler).getMethod();
|
||||
|
||||
// 进行验证
|
||||
SaManager.getSaTokenAction().checkMethodAnnotation(method);
|
||||
SaStrategy.me.checkMethodAnnotation.accept(method);
|
||||
|
||||
// 通过验证
|
||||
return true;
|
||||
|
@@ -5,7 +5,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.util.PathMatcher;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.action.SaTokenAction;
|
||||
import cn.dev33.satoken.basic.SaBasicTemplate;
|
||||
import cn.dev33.satoken.basic.SaBasicUtil;
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
@@ -63,7 +62,7 @@ public class SaBeanInject {
|
||||
* @param saTokenAction SaTokenAction对象
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setSaTokenAction(SaTokenAction saTokenAction) {
|
||||
public void setSaTokenAction(@SuppressWarnings("deprecation") cn.dev33.satoken.action.SaTokenAction saTokenAction) {
|
||||
SaManager.setSaTokenAction(saTokenAction);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user