refactor: Update JwtTokenProvider to use HS512 algorithm for signing tokens

This commit is contained in:
andrea.terzani
2024-08-13 09:32:37 +02:00
parent 52df0c613a
commit 3580789de5

View File

@@ -21,7 +21,7 @@ public class JwtTokenProvider {
Key key = Keys.secretKeyFor(SignatureAlgorithm.HS512);
public static final String SECRET = "5367566B59703373367639792F423F4528482B4D6251655468576D5A71347437";
public static final String SECRET = "5367566B59703373367639792F423F4528482B4D6251655468576D5A713474375367566B59703373367639792F423F4528482B4D6251655468576D5A71347437";
private Key getSignKey() {
@@ -40,7 +40,8 @@ public class JwtTokenProvider {
.setSubject(userDetails.getUsername())
.setIssuedAt(new Date())
.setExpiration(expiryDate)
.signWith(getSignKey(), SignatureAlgorithm.HS256)
.signWith(getSignKey(), SignatureAlgorithm.HS512)
//.signWith(SignatureAlgorithm.HS512, SECRET)
.compact();
}
@@ -83,5 +84,4 @@ public class JwtTokenProvider {
.getBody()
.getSubject();
}
}
}