mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-05-14 12:52:08 +08:00
!332 feat(sa-token): 在 SaCheckOr 注解中添加 apikey 支持
Merge pull request !332 from KairosSun/dev
This commit is contained in:
@@ -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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user