Skip to content

Commit

Permalink
-fix can't commit response (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
zubair527 authored and isopropylcyanide committed Jan 1, 2020
1 parent dbcff61 commit e6da47e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ public Long getUserIdFromJWT(String token) {
* Validates if a token has the correct unmalformed signature and is not expired or unsupported.
*/
public boolean validateToken(String authToken) {
boolean isTokenVerified = false;
try {
Jwts.parser().setSigningKey(jwtSecret).parseClaimsJws(authToken);
return true;
isTokenVerified = true;
} catch (SignatureException ex) {
logger.error("Invalid JWT signature");
throw new InvalidTokenRequestException("JWT", authToken, "Incorrect signature");
Expand All @@ -93,6 +94,8 @@ public boolean validateToken(String authToken) {
} catch (IllegalArgumentException ex) {
logger.error("JWT claims string is empty.");
throw new InvalidTokenRequestException("JWT", authToken, "Illegal argument token");
}finally {
return isTokenVerified;
}
}

Expand All @@ -103,4 +106,4 @@ public boolean validateToken(String authToken) {
public Long getExpiryDuration() {
return jwtExpirationInMs;
}
}
}

0 comments on commit e6da47e

Please sign in to comment.