Package com.auth0.jwt
Class JWTDecoder
java.lang.Object
com.auth0.jwt.JWTDecoder
- All Implemented Interfaces:
DecodedJWT,Header,Payload
The JWTDecoder class holds the decode method to parse a given JWT token into it's JWT representation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for the Algorithm "alg" claim defined in the JWT's Header.Get the value of the "aud" claim, or null if it's not available.Get a Claim given it's name.Get the Claims defined in the Token.Getter for the Content Type "cty" claim defined in the JWT's Header.Get the value of the "exp" claim, or null if it's not available.Getter for the Header contained in the JWT as a Base64 encoded String.getHeaderClaim(String name) Get a Private Claim given it's name.getId()Get the value of the "jti" claim, or null if it's not available.Get the value of the "iat" claim, or null if it's not available.Get the value of the "iss" claim, or null if it's not available.getKeyId()Get the value of the "kid" claim, or null if it's not available.Get the value of the "nbf" claim, or null if it's not available.Getter for the Payload contained in the JWT as a Base64 encoded String.Getter for the Signature contained in the JWT as a Base64 encoded String.Get the value of the "sub" claim, or null if it's not available.getToken()Getter for the String Token used to create this JWT instance.getType()Getter for the Type "typ" claim defined in the JWT's Header.
-
Field Details
-
parts
-
header
-
payload
-
-
Constructor Details
-
JWTDecoder
JWTDecoder(String jwt) throws JWTDecodeException - Throws:
JWTDecodeException
-
JWTDecoder
JWTDecoder(JWTParser converter, String jwt) throws JWTDecodeException - Throws:
JWTDecodeException
-
-
Method Details
-
getAlgorithm
Description copied from interface:HeaderGetter for the Algorithm "alg" claim defined in the JWT's Header. If the claim is missing it will return null.- Specified by:
getAlgorithmin interfaceHeader- Returns:
- the Algorithm defined or null.
-
getType
Description copied from interface:HeaderGetter for the Type "typ" claim defined in the JWT's Header. If the claim is missing it will return null. -
getContentType
Description copied from interface:HeaderGetter for the Content Type "cty" claim defined in the JWT's Header. If the claim is missing it will return null.- Specified by:
getContentTypein interfaceHeader- Returns:
- the Content Type defined or null.
-
getKeyId
Description copied from interface:HeaderGet the value of the "kid" claim, or null if it's not available. -
getHeaderClaim
Description copied from interface:HeaderGet a Private Claim given it's name. If the Claim wasn't specified in the Header, a NullClaim will be returned.- Specified by:
getHeaderClaimin interfaceHeader- Parameters:
name- the name of the Claim to retrieve.- Returns:
- a non-null Claim.
-
getIssuer
Description copied from interface:PayloadGet the value of the "iss" claim, or null if it's not available. -
getSubject
Description copied from interface:PayloadGet the value of the "sub" claim, or null if it's not available.- Specified by:
getSubjectin interfacePayload- Returns:
- the Subject value or null.
-
getAudience
Description copied from interface:PayloadGet the value of the "aud" claim, or null if it's not available.- Specified by:
getAudiencein interfacePayload- Returns:
- the Audience value or null.
-
getExpiresAt
Description copied from interface:PayloadGet the value of the "exp" claim, or null if it's not available.- Specified by:
getExpiresAtin interfacePayload- Returns:
- the Expiration Time value or null.
-
getNotBefore
Description copied from interface:PayloadGet the value of the "nbf" claim, or null if it's not available.- Specified by:
getNotBeforein interfacePayload- Returns:
- the Not Before value or null.
-
getIssuedAt
Description copied from interface:PayloadGet the value of the "iat" claim, or null if it's not available.- Specified by:
getIssuedAtin interfacePayload- Returns:
- the Issued At value or null.
-
getId
Description copied from interface:PayloadGet the value of the "jti" claim, or null if it's not available. -
getClaim
Description copied from interface:PayloadGet a Claim given it's name. If the Claim wasn't specified in the Payload, a NullClaim will be returned. -
getClaims
Description copied from interface:PayloadGet the Claims defined in the Token. -
getHeader
Description copied from interface:DecodedJWTGetter for the Header contained in the JWT as a Base64 encoded String. This represents the first part of the token.- Specified by:
getHeaderin interfaceDecodedJWT- Returns:
- the Header of the JWT.
-
getPayload
Description copied from interface:DecodedJWTGetter for the Payload contained in the JWT as a Base64 encoded String. This represents the second part of the token.- Specified by:
getPayloadin interfaceDecodedJWT- Returns:
- the Payload of the JWT.
-
getSignature
Description copied from interface:DecodedJWTGetter for the Signature contained in the JWT as a Base64 encoded String. This represents the third part of the token.- Specified by:
getSignaturein interfaceDecodedJWT- Returns:
- the Signature of the JWT.
-
getToken
Description copied from interface:DecodedJWTGetter for the String Token used to create this JWT instance.- Specified by:
getTokenin interfaceDecodedJWT- Returns:
- the String Token.
-