Package com.auth0.jwt
Class JWTVerifier
- java.lang.Object
-
- com.auth0.jwt.JWTVerifier
-
- All Implemented Interfaces:
JWTVerifier
public final class JWTVerifier extends java.lang.Object implements JWTVerifier
The JWTVerifier class holds the verify method to assert that a given Token has not only a proper JWT format, but also its signature matches.This class is thread-safe.
- See Also:
JWTVerifier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JWTVerifier.BaseVerification
Verification
implementation that accepts all the expected Claim values for verification, and builds aJWTVerifier
used to verify a JWT's signature and expected claims.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DecodedJWT
verify(DecodedJWT jwt)
Perform the verification against the given decoded JWT, using any previous configured options.DecodedJWT
verify(java.lang.String token)
Perform the verification against the given Token, using any previous configured options.
-
-
-
Method Detail
-
verify
public DecodedJWT verify(java.lang.String token) throws JWTVerificationException
Perform the verification against the given Token, using any previous configured options.- Specified by:
verify
in interfaceJWTVerifier
- Parameters:
token
- to verify.- Returns:
- a verified and decoded JWT.
- Throws:
AlgorithmMismatchException
- if the algorithm stated in the token's header is not equal to the one defined in theJWTVerifier
.SignatureVerificationException
- if the signature is invalid.TokenExpiredException
- if the token has expired.MissingClaimException
- if a claim to be verified is missing.IncorrectClaimException
- if a claim contained a different value than the expected one.JWTVerificationException
- if any of the verification steps fail
-
verify
public DecodedJWT verify(DecodedJWT jwt) throws JWTVerificationException
Perform the verification against the given decoded JWT, using any previous configured options.- Specified by:
verify
in interfaceJWTVerifier
- Parameters:
jwt
- to verify.- Returns:
- a verified and decoded JWT.
- Throws:
AlgorithmMismatchException
- if the algorithm stated in the token's header is not equal to the one defined in theJWTVerifier
.SignatureVerificationException
- if the signature is invalid.TokenExpiredException
- if the token has expired.MissingClaimException
- if a claim to be verified is missing.IncorrectClaimException
- if a claim contained a different value than the expected one.JWTVerificationException
- if any of the verification steps fail
-
-