feat(code): SaCheckOr 注解添加 append 字段,用于抓取未预先定义的注解类型进行批量注解鉴权

This commit is contained in:
click33
2025-05-15 01:04:54 +08:00
parent 3e13a39244
commit 3edac001ce
26 changed files with 125 additions and 73 deletions

View File

@@ -6,7 +6,7 @@ import cn.dev33.satoken.exception.SaTokenException;
import com.pj.satoken.custom_annotation.CheckAccount;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
/**
* 注解 CheckAccount 的处理器
@@ -25,7 +25,7 @@ public class CheckAccountHandler implements SaAnnotationHandlerInterface<CheckAc
// 每次请求校验注解时,会执行的方法
@Override
public void checkMethod(CheckAccount at, Method method) {
public void checkMethod(CheckAccount at, AnnotatedElement element) {
// 获取前端请求提交的参数
String name = SaHolder.getRequest().getParamNotNull("name");
String pwd = SaHolder.getRequest().getParamNotNull("pwd");

View File

@@ -6,7 +6,7 @@ import com.pj.satoken.StpUserUtil;
import com.pj.satoken.custom_annotation.SaUserCheckLogin;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
/**
* 注解 SaUserCheckLogin 的处理器
@@ -22,7 +22,7 @@ public class SaUserCheckLoginHandler implements SaAnnotationHandlerInterface<SaU
}
@Override
public void checkMethod(SaUserCheckLogin at, Method method) {
public void checkMethod(SaUserCheckLogin at, AnnotatedElement element) {
SaCheckLoginHandler._checkMethod(StpUserUtil.TYPE);
}

View File

@@ -6,7 +6,7 @@ import com.pj.satoken.StpUserUtil;
import com.pj.satoken.custom_annotation.SaUserCheckPermission;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
/**
* 注解 SaUserCheckPermission 的处理器
@@ -22,7 +22,7 @@ public class SaUserCheckPermissionHandler implements SaAnnotationHandlerInterfac
}
@Override
public void checkMethod(SaUserCheckPermission at, Method method) {
public void checkMethod(SaUserCheckPermission at, AnnotatedElement element) {
SaCheckPermissionHandler._checkMethod(StpUserUtil.TYPE, at.value(), at.mode(), at.orRole());
}

View File

@@ -6,7 +6,7 @@ import com.pj.satoken.StpUserUtil;
import com.pj.satoken.custom_annotation.SaUserCheckRole;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
/**
* 注解 SaUserCheckRole 的处理器
@@ -22,7 +22,7 @@ public class SaUserCheckRoleHandler implements SaAnnotationHandlerInterface<SaUs
}
@Override
public void checkMethod(SaUserCheckRole at, Method method) {
public void checkMethod(SaUserCheckRole at, AnnotatedElement element) {
SaCheckRoleHandler._checkMethod(StpUserUtil.TYPE, at.value(), at.mode());
}

View File

@@ -6,7 +6,7 @@ import com.pj.satoken.StpUserUtil;
import com.pj.satoken.custom_annotation.SaUserCheckSafe;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.AnnotatedElement;
/**
* 注解 SaUserCheckPermission 的处理器
@@ -22,7 +22,7 @@ public class SaUserCheckSafeHandler implements SaAnnotationHandlerInterface<SaUs
}
@Override
public void checkMethod(SaUserCheckSafe at, Method method) {
public void checkMethod(SaUserCheckSafe at, AnnotatedElement element) {
SaCheckSafeHandler._checkMethod(StpUserUtil.TYPE, at.value());
}

View File

@@ -69,7 +69,7 @@ public class AtController {
public SaResult checkSafe() {
return SaResult.ok();
}
// 通过Basic认证后才可以进入 ---- http://localhost:8081/at/checkBasic
@SaCheckHttpBasic(account = "sa:123456")
@RequestMapping("checkBasic")