yl-backend/src/main/java/com/guwan/backend/constant/SecurityConstants.java

40 lines
1.2 KiB
Java

package com.guwan.backend.constant;
import java.util.List;
/**
* 安全相关常量配置
*/
public class SecurityConstants {
/**
* API接口白名单
* 这些路径可以直接访问,不需要认证
*/
public static final List<String> WHITE_LIST = List.of(
"/common/**", //公共接口
"/demo/**", // 测试接口
"/api/products",
"/api/user/register", // 用户注册
"/api/user/login", // 用户登录
"/api/user/getEmailCode", // 获取邮箱验证码
"/api/user/getPhoneCode", // 获取手机验证码
"/chat.html",
"/v3/api-docs/**", // Swagger API文档
"/swagger-ui/**", // Swagger UI
"/swagger-ui.html", // Swagger UI HTML
"/swagger-resources/**", // Swagger 资源
"/webjars/**" // Swagger UI 相关资源
);
/**
* 静态资源白名单
* 这些路径用于访问静态资源,不需要认证
*/
public static final List<String> STATIC_RESOURCES = List.of(
"/static/**", // 静态资源目录
"/public/**", // 公共资源目录
"/error" // 错误页面
);
}