You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

package com.annotation;
import java.lang.annotation.*;
/**
* 忽略身份验证的自定义注解
*
* <p>该注解用于标记需要跳过 Token 验证机制的控制器方法,
* 通常用于公开访问的接口(如公告查询、公开规则说明等)。
*
* <p><b>典型使用场景:</b>
* <ul>
* <li>系统公告获取接口</li>
* <li>快递业务规则说明页面</li>
* <li>公开的数据查询接口</li>
* <li>无需登录的公共服务端点</li>
* </ul>
*
* @author YourName
* @version 1.0
* @since 2023-10-01
*/
@Target(ElementType.METHOD) // 限定注解仅能应用于方法级别
@Retention(RetentionPolicy.RUNTIME) // 注解在运行时保留,可通过反射读取
@Documented // 表明该注解应包含在 Javadoc 中
public @interface IgnoreAuth {
/**
* 验证豁免级别(扩展点)
*
* <p>预留属性用于未来扩展多级验证场景:
* <ul>
* <li><code>NONE</code> - 完全跳过验证(默认)</li>
* <li><code>BASIC</code> - 跳过 Token 但仍需设备验证</li>
* <li><code>PARTIAL</code> - 跳过 Token 但验证基础参数</li>
* </ul>
*
* @return 豁免级别标识符
*/
// 预留扩展属性(示例)
// String level() default "NONE";
}