From 4eebd3d1b0996817ad9c4f81b3be736eee80934b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E4=B8=99?= <10604541+sanbing-os@user.noreply.gitee.com> Date: Thu, 11 Sep 2025 19:39:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/service/security/model/token/JwtTokenFactory.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/jcpp-app/src/main/java/sanbing/jcpp/app/service/security/model/token/JwtTokenFactory.java b/jcpp-app/src/main/java/sanbing/jcpp/app/service/security/model/token/JwtTokenFactory.java index 77be1a3..8427808 100644 --- a/jcpp-app/src/main/java/sanbing/jcpp/app/service/security/model/token/JwtTokenFactory.java +++ b/jcpp-app/src/main/java/sanbing/jcpp/app/service/security/model/token/JwtTokenFactory.java @@ -34,8 +34,6 @@ import java.util.stream.Collectors; @Slf4j public class JwtTokenFactory { - public static int KEY_LENGTH = Jwts.SIG.HS512.getKeyBitLength(); - private static final String SCOPES = "scopes"; private static final String USER_ID = "userId"; private static final String USER_NAME = "userName"; @@ -48,9 +46,6 @@ public class JwtTokenFactory { private volatile JwtParser jwtParser; private volatile SecretKey secretKey; - /** - * Factory method for issuing new JWT Tokens. - */ public AccessJwtToken createAccessJwtToken(SecurityUser securityUser) { if (securityUser.getAuthority() == null) { throw new IllegalArgumentException("User doesn't have any privileges"); @@ -106,7 +101,7 @@ public class JwtTokenFactory { if (scopes == null || scopes.isEmpty()) { throw new IllegalArgumentException("Refresh Token doesn't have any scopes"); } - if (!scopes.get(0).equals(AuthorityEnum.REFRESH_TOKEN.name())) { + if (!scopes.getFirst().equals(AuthorityEnum.REFRESH_TOKEN.name())) { throw new IllegalArgumentException("Invalid Refresh Token scope"); } UserPrincipal principal = new UserPrincipal(subject);