1
0
mirror of synced 2026-05-22 14:43:15 +00:00
This commit is contained in:
click33
2025-04-30 03:56:10 +08:00
2 changed files with 10 additions and 1 deletions
@@ -81,4 +81,11 @@ public @interface SaCheckOr {
*/ */
SaCheckDisable[] disable() default {}; SaCheckDisable[] disable() default {};
/**
* 设定 @SaCheckApiKey,参考 {@link SaCheckApiKey}
*
* @return /
*/
SaCheckApiKey[] apikey() default {};
} }
@@ -40,7 +40,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
@Override @Override
public void checkMethod(SaCheckOr at, Method method) { public void checkMethod(SaCheckOr at, Method method) {
_checkMethod(at.login(), at.role(), at.permission(), at.safe(), at.httpBasic(), at.httpDigest(), at.disable(), method); _checkMethod(at.login(), at.role(), at.permission(), at.safe(), at.httpBasic(), at.httpDigest(), at.disable(), at.apikey(), method);
} }
public static void _checkMethod( public static void _checkMethod(
@@ -51,6 +51,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
SaCheckHttpBasic[] httpBasic, SaCheckHttpBasic[] httpBasic,
SaCheckHttpDigest[] httpDigest, SaCheckHttpDigest[] httpDigest,
SaCheckDisable[] disable, SaCheckDisable[] disable,
SaCheckApiKey[] apikey,
Method method Method method
) { ) {
// 先把所有注解塞到一个 list 里 // 先把所有注解塞到一个 list 里
@@ -62,6 +63,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
annotationList.addAll(Arrays.asList(disable)); annotationList.addAll(Arrays.asList(disable));
annotationList.addAll(Arrays.asList(httpBasic)); annotationList.addAll(Arrays.asList(httpBasic));
annotationList.addAll(Arrays.asList(httpDigest)); annotationList.addAll(Arrays.asList(httpDigest));
annotationList.addAll(Arrays.asList(apikey));
// 如果 atList 为空,说明 SaCheckOr 上不包含任何注解校验,我们直接跳过即可 // 如果 atList 为空,说明 SaCheckOr 上不包含任何注解校验,我们直接跳过即可
if(annotationList.isEmpty()) { if(annotationList.isEmpty()) {