Skip to content

Commit

Permalink
fix: JwtUtils#validateJwtToken does not handle ExpiredJwtException pr…
Browse files Browse the repository at this point in the history
…operly
  • Loading branch information
shorinami committed Jan 12, 2024
1 parent a04167b commit 66e1515
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/sellbycar/marketplace/auth/JwtUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.sellbycar.marketplace.user.UserDetailsImpl;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.io.Decoders;
Expand Down Expand Up @@ -85,6 +86,7 @@ public boolean validateJwtToken(@NonNull String token, @NonNull Key secret) {
Jwts.parser().setSigningKey(secret).build().parse(token);
return true;
} catch (Exception e) {
if (e instanceof ExpiredJwtException) return false;
logger.error("Failed to validate JWT token", e);
}

Expand Down

0 comments on commit 66e1515

Please sign in to comment.