mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-06-28 13:34:18 +08:00
feat(sa-token): 在 SaCheckOr 注解中添加 apikey 支持
- 在 SaCheckOr 注解中添加 apikey 属性,用于设定 @SaCheckApiKey - 更新 SaCheckOrHandler 类,支持处理新增的 apikey 属性- 此更新扩展了 SaCheckOr 注解的功能,使其能够支持 API 密钥的验证
This commit is contained in:
parent
abdfb2305d
commit
a17befcebb
@ -81,4 +81,11 @@ public @interface SaCheckOr {
|
||||
*/
|
||||
SaCheckDisable[] disable() default {};
|
||||
|
||||
/**
|
||||
* 设定 @SaCheckApiKey,参考 {@link SaCheckApiKey}
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
SaCheckApiKey[] apikey() default {};
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
|
||||
|
||||
@Override
|
||||
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(
|
||||
@ -51,6 +51,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
|
||||
SaCheckHttpBasic[] httpBasic,
|
||||
SaCheckHttpDigest[] httpDigest,
|
||||
SaCheckDisable[] disable,
|
||||
SaCheckApiKey[] apikey,
|
||||
Method method
|
||||
) {
|
||||
// 先把所有注解塞到一个 list 里
|
||||
@ -62,6 +63,7 @@ public class SaCheckOrHandler implements SaAnnotationHandlerInterface<SaCheckOr>
|
||||
annotationList.addAll(Arrays.asList(disable));
|
||||
annotationList.addAll(Arrays.asList(httpBasic));
|
||||
annotationList.addAll(Arrays.asList(httpDigest));
|
||||
annotationList.addAll(Arrays.asList(apikey));
|
||||
|
||||
// 如果 atList 为空,说明 SaCheckOr 上不包含任何注解校验,我们直接跳过即可
|
||||
if(annotationList.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user