This commit is contained in:
2025-12-02 13:36:09 +08:00
parent ee6dd64f98
commit 94718edd6b
97 changed files with 570 additions and 579 deletions

View File

@@ -16,11 +16,11 @@ public @interface HttpLogin {
/**
* @description 是否必需默认为true
* @return boolean
* @return BOOLEAN
* @author yslg
* @since 2025-11-02
*/
boolean required() default true;
BOOLEAN required() default true;
/**
* @description 当token无效时的错误消息

View File

@@ -42,7 +42,7 @@ public class HttpLoginArgumentResolver implements HandlerMethodArgumentResolver
private static final String REDIS_LOGIN_PREFIX = "login:token:";
@Override
public boolean supportsParameter(MethodParameter parameter) {
public BOOLEAN supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(HttpLogin.class)
&& LoginDomain.class.isAssignableFrom(parameter.getParameterType());
}

View File

@@ -21,7 +21,7 @@ public class AuthProperties {
* 是否启用认证过滤器
* 默认启用
*/
private boolean enabled = true;
private BOOLEAN enabled = true;
/**
* 登录接口路径
@@ -72,11 +72,11 @@ public class AuthProperties {
whitelist.add("/error");
}
public boolean isEnabled() {
public BOOLEAN isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
public void setEnabled(BOOLEAN enabled) {
this.enabled = enabled;
}

View File

@@ -178,7 +178,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
/**
* 检查路径是否在白名单中
*/
private boolean isWhitelisted(@NonNull String path) {
private BOOLEAN isWhitelisted(@NonNull String path) {
// 1. 先检查认证相关接口login / logout / captcha / refresh
if (authProperties.getAuthPaths() != null) {
for (String pattern : authProperties.getAuthPaths()) {

View File

@@ -34,12 +34,12 @@ public class JwtTokenParser implements TokenParser {
}
@Override
public boolean validateToken(String token, String userId) {
public BOOLEAN validateToken(String token, String userId) {
return jwtTokenUtil.validateToken(token, userId);
}
@Override
public boolean isTokenExpired(String token) {
public BOOLEAN isTokenExpired(String token) {
return jwtTokenUtil.isTokenExpired(token);
}
}

View File

@@ -33,19 +33,19 @@ public interface TokenParser {
* @description 验证令牌
* @param token 令牌
* @param userId 用户ID
* @return boolean 是否有效
* @return BOOLEAN 是否有效
* @author yslg
* @since 2025-11-02
*/
boolean validateToken(String token, String userId);
BOOLEAN validateToken(String token, String userId);
/**
* @description 检查令牌是否过期
* @param token 令牌
* @return boolean 是否过期
* @return BOOLEAN 是否过期
* @author yslg
* @since 2025-11-02
*/
boolean isTokenExpired(String token);
BOOLEAN isTokenExpired(String token);
}

View File

@@ -114,11 +114,11 @@ public class JwtTokenUtil {
* @description 验证令牌
* @param token JWT令牌
* @param userId 用户ID
* @return boolean 是否有效
* @return BOOLEAN 是否有效
* @author yslg
* @since 2025-11-07
*/
public boolean validateToken(String token, String userId) {
public BOOLEAN validateToken(String token, String userId) {
try {
final String tokenUserId = getUserIdFromToken(token);
return (userId.equals(tokenUserId) && !isTokenExpired(token));
@@ -130,11 +130,11 @@ public class JwtTokenUtil {
/**
* @description 检查令牌是否过期
* @param token JWT令牌
* @return boolean 是否过期
* @return BOOLEAN 是否过期
* @author yslg
* @since 2025-11-07
*/
public boolean isTokenExpired(String token) {
public BOOLEAN isTokenExpired(String token) {
final Date expiration = getExpirationDateFromToken(token);
return expiration.before(new Date());
}