Skip to content

Commit 8304a98

Browse files
committed
fix:update JwtUtil generateToken
1 parent e3c817f commit 8304a98

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • base/src/main/java/com/tinyengine/it/login/utils

base/src/main/java/com/tinyengine/it/login/utils/JwtUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ public static SecretKey getSecretKey() {
9797
*/
9898
public String generateToken(String username, String roles, String userId,
9999
Object tenants, Integer platformId) {
100-
100+
if(username==null ){
101+
throw new IllegalArgumentException("Username must not be null");
102+
}
101103
Map<String, Object> claims = new HashMap<>();
102104
claims.put("username", username);
103105
claims.put("roles", roles);
@@ -132,9 +134,6 @@ public String generateToken(String username, String roles, String userId,
132134
*/
133135
public String generateToken(String username, String roles, String userId,
134136
List<Tenant> tenants, Integer platformId) {
135-
if(username==null ){
136-
throw new IllegalArgumentException("Username must not be null");
137-
}
138137
return generateToken(username, roles, userId, (Object) tenants, platformId);
139138
}
140139

0 commit comments

Comments
 (0)