Skip to content

Commit

Permalink
Merge pull request #11500 from dschulz/patch_jwts_usage_deprecation_w…
Browse files Browse the repository at this point in the history
…arning

Fix Jwts usage to get rid of the deprecation warning
  • Loading branch information
DanielFran authored May 7, 2020
2 parents 5407e99 + 5931e76 commit c949b1e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,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 @@ -123,7 +124,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 c949b1e

Please sign in to comment.