废弃 SaTokenAction 接口,新增 SaStrategy 策略类

This commit is contained in:
click33
2021-09-28 23:57:56 +08:00
parent 356e65f749
commit 713e11482c
17 changed files with 234 additions and 88 deletions

View File

@@ -13,6 +13,7 @@ import cn.dev33.satoken.oauth2.model.CodeModel;
import cn.dev33.satoken.oauth2.model.RefreshTokenModel;
import cn.dev33.satoken.oauth2.model.RequestAuthModel;
import cn.dev33.satoken.oauth2.model.SaClientModel;
import cn.dev33.satoken.strategy.SaStrategy;
import cn.dev33.satoken.util.SaFoxUtil;
/**
@@ -358,7 +359,7 @@ public class SaOAuth2Template {
// 3、是否在[允许地址列表]之中
List<String> allowList = SaFoxUtil.convertStringToList(checkClientModel(clientId).allowUrl);
if(SaManager.getSaTokenAction().hasElement(allowList, url) == false) {
if(SaStrategy.me.hasElement.apply(allowList, url) == false) {
throw new SaOAuth2Exception("非法redirect_url" + url);
}
}

View File

@@ -8,7 +8,7 @@ import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.strategy.SaStrategy;
import cn.dev33.satoken.util.SaTokenConsts;
/**
@@ -56,7 +56,7 @@ public class SaCheckAspect {
// 注解鉴权
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
SaManager.getSaTokenAction().checkMethodAnnotation(signature.getMethod());
SaStrategy.me.checkMethodAnnotation.accept(signature.getMethod());
try {
// 执行原有逻辑