Skip to content

Commit b2eac86

Browse files
committed
add specific exceptions to JWTVerifier#verify javadoc
1 parent 0001be0 commit b2eac86

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/main/java/com/auth0/jwt/JWTVerifier.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,10 @@ private void requireClaim(String name, Object value) {
343343
*
344344
* @param token to verify.
345345
* @return a verified and decoded JWT.
346-
* @throws JWTVerificationException if any of the required contents inside the JWT is invalid.
346+
* @throws AlgorithmMismatchException if the algorithm stated in the token's header it's not equal to the one defined in the {@link JWTVerifier}.
347+
* @throws SignatureVerificationException if the signature is invalid.
348+
* @throws TokenExpiredException if the token has expired.
349+
* @throws InvalidClaimException if a claim contained a different value than the expected one.
347350
*/
348351
public DecodedJWT verify(String token) throws JWTVerificationException {
349352
DecodedJWT jwt = JWT.decode(token);
@@ -359,7 +362,7 @@ private void verifyAlgorithm(DecodedJWT jwt, Algorithm expectedAlgorithm) throws
359362
}
360363
}
361364

362-
private void verifyClaims(DecodedJWT jwt, Map<String, Object> claims) {
365+
private void verifyClaims(DecodedJWT jwt, Map<String, Object> claims) throws TokenExpiredException, InvalidClaimException {
363366
for (Map.Entry<String, Object> entry : claims.entrySet()) {
364367
switch (entry.getKey()) {
365368
case PublicClaims.AUDIENCE:

0 commit comments

Comments
 (0)