Package com.auth0.jwt
Class JWT
java.lang.Object
com.auth0.jwt.JWT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JWTCreator.Buildercreate()Returns a Json Web Token builder used to create and sign tokensstatic DecodedJWTDecode a given Json Web Token.Decode a given Json Web Token.static VerificationReturns aJWTVerifierbuilder with the algorithm to be used to validate token signature.
-
Constructor Details
-
JWT
public JWT()Constructs a new instance of the JWT library. Use this if you need to decode many JWT tokens on the fly and do not wish to instantiate a new parser for each invocation.
-
-
Method Details
-
decodeJwt
Decode a given Json Web Token.Note that this method doesn't verify the token's signature! Use it only if you trust the token or you already verified it.
- Parameters:
token- with jwt format as string.- Returns:
- a decoded JWT.
- Throws:
JWTDecodeException- if any part of the token contained an invalid jwt or JSON format of each of the jwt parts.
-
decode
Decode a given Json Web Token.Note that this method doesn't verify the token's signature! Use it only if you trust the token or you already verified it.
- Parameters:
token- with jwt format as string.- Returns:
- a decoded JWT.
- Throws:
JWTDecodeException- if any part of the token contained an invalid jwt or JSON format of each of the jwt parts.
-
require
Returns aJWTVerifierbuilder with the algorithm to be used to validate token signature.- Parameters:
algorithm- that will be used to verify the token's signature.- Returns:
JWTVerifierbuilder- Throws:
IllegalArgumentException- if the provided algorithm is null.
-
create
Returns a Json Web Token builder used to create and sign tokens- Returns:
- a token builder.
-