类型修正
This commit is contained in:
@@ -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无效时的错误消息
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user