|
|
@@ -14,10 +14,14 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import cn.dev33.satoken.annotation.SaCheckRole;
|
|
|
import cn.dev33.satoken.annotation.SaCheckSafe;
|
|
|
import cn.dev33.satoken.basic.SaBasicUtil;
|
|
|
+import cn.dev33.satoken.exception.NotPermissionException;
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
|
+import cn.dev33.satoken.stp.StpLogic;
|
|
|
import cn.dev33.satoken.strategy.SaStrategy;
|
|
|
import cn.dev33.satoken.util.SaFoxUtil;
|
|
|
import cn.dev33.satoken.util.SaTokenConsts;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.nb.auth.utils.SecurityUtil;
|
|
|
|
|
|
/**
|
|
|
* <h1> v1.27+ 此接口已废弃,目前版本暂时向下兼容,请及时更换为 SaStrategy </h1>
|
|
|
@@ -116,7 +120,7 @@ public class SaTokenActionDefaultImpl implements SaTokenAction {
|
|
|
*/
|
|
|
@Override
|
|
|
public void validateAnnotation(AnnotatedElement target) {
|
|
|
-
|
|
|
+
|
|
|
// 校验 @SaCheckLogin 注解
|
|
|
SaCheckLogin checkLogin = (SaCheckLogin) SaStrategy.me.getAnnotation.apply(target, SaCheckLogin.class);
|
|
|
if(checkLogin != null) {
|
|
|
@@ -132,6 +136,11 @@ public class SaTokenActionDefaultImpl implements SaTokenAction {
|
|
|
// 校验 @SaCheckPermission 注解
|
|
|
SaCheckPermission checkPermission = (SaCheckPermission) SaStrategy.me.getAnnotation.apply(target, SaCheckPermission.class);
|
|
|
if(checkPermission != null) {
|
|
|
+ String type= StrUtil.isBlankIfStr(checkPermission.type())?"login":checkPermission.type();
|
|
|
+ StpLogic stpLogic = SecurityUtil.getStpLogic();
|
|
|
+ if (!type.equals(stpLogic.getLoginType())) {
|
|
|
+ throw new NotPermissionException("无权限访问此体系接口");
|
|
|
+ }
|
|
|
SaManager.getStpLogic(checkPermission.type()).checkByAnnotation(checkPermission);
|
|
|
}
|
|
|
|