Skip to content

Commit

Permalink
Fix Jwts usage to get rid of the deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dschulz committed Mar 23, 2020
1 parent b9240e6 commit 5931e76
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -100,8 +100,9 @@ public class TokenProvider {
}

public Authentication getAuthentication(String token) {
Claims claims = Jwts.parser()
Claims claims = Jwts.parserBuilder()
.setSigningKey(key)
.build()
.parseClaimsJws(token)
.getBody();

Expand All @@ -117,7 +118,7 @@ public class TokenProvider {

public boolean validateToken(String authToken) {
try {
Jwts.parser().setSigningKey(key).parseClaimsJws(authToken);
Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(authToken);
return true;
} catch (JwtException | IllegalArgumentException e) {
log.info("Invalid JWT token.");
Expand Down

0 comments on commit 5931e76

Please sign in to comment.