wip: 临时提交

This commit is contained in:
Ray.Hao
2025-03-07 08:20:53 +08:00
parent 3209b0b3ae
commit a84f2b9988
14 changed files with 86 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
package com.youlai.boot.common.constant;
/**
* Redis Key常量
* Redis 常量
*
* @author Theo
* @since 2024-7-29 11:46:08
@@ -9,32 +9,41 @@ package com.youlai.boot.common.constant;
public interface RedisConstants {
/**
* 系统配置 Redis
* 限流相关
*/
String SYSTEM_CONFIG_KEY = "system:config";
interface RateLimiter {
String IP = "rate_limiter:ip:{}"; // IP限流示例rate_limiter:ip:192.168.1.1
}
/**
* 分布式锁相关键
*/
interface Lock {
String RESUBMIT = "lock:resubmit:{}:{}"; // 防重复提交示例lock:resubmit:methodName:md5Hash
}
/**
* 认证模块
*/
interface Auth {
String BLACKLIST_TOKEN = "auth:token:blacklist:{}"; // 黑名单Token
}
/**
* IP 限流 Redis 键
* 验证码模块
*/
String IP_RATE_LIMITER_KEY = "rate:limiter:ip:";
interface Captcha {
String IMAGE_CODE = "captcha:image:{}"; // 图形验证码
String SMS_LOGIN_CODE = "captcha:sms_login:{}"; // 登录短信验证码
String SMS_REGISTER_CODE = "captcha:sms_register:{}";// 注册短信验证码
String MOBILE_CODE = "captcha:mobile:{}"; // 绑定、更换手机验证码
String EMAIL_CODE = "captcha:email:{}"; // 邮箱验证码
}
/**
* 防重复提交 Redis 键前缀
* 系统模块
*/
String RESUBMIT_LOCK_PREFIX = "lock:resubmit:";
interface System {
String CONFIG = "system:config"; // 系统配置
String ROLE_PERMS = "system:role:perms"; // 系统角色和权限映射
}
/**
* 登录手机验证码 Redis 键前缀
*/
String SMS_LOGIN_CODE_PREFIX= "code:sms:login:";
/**
* 绑定或更换手机号验证码 Redis 键前缀
*/
String SMS_CHANGE_CODE_PREFIX = "code:sms:change:";
/**
* 绑定或更换邮箱验证码 Redis 键前缀
*/
String EMAIL_CHANGE_CODE_PREFIX = "code:email:change:";
}

View File

@@ -8,21 +8,6 @@ package com.youlai.boot.common.constant;
*/
public interface SecurityConstants {
/**
* 验证码缓存前缀
*/
String CAPTCHA_CODE_PREFIX = "captcha_code:";
/**
* 角色和权限缓存前缀
*/
String ROLE_PERMS_PREFIX = "role_perms:";
/**
* 黑名单Token缓存前缀
*/
String BLACKLIST_TOKEN_PREFIX = "token:blacklist:";
/**
* 登录路径
*/
@@ -31,7 +16,7 @@ public interface SecurityConstants {
/**
* JWT Token 前缀
*/
String JWT_TOKEN_PREFIX = "Bearer ";
String BEARER_TOKEN_PREFIX = "Bearer ";
/**
* 角色前缀,用于区分 authorities 角色和权限, ROLE_* 角色 、没有前缀的是权限