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:Header
Getter for the Algorithm "alg" claim defined in the JWT's Header. If the claim is missing it will return null.- Specified by:
getAlgorithm
in interfaceHeader
- Returns:
- the Algorithm defined or null.
-
getType
Description copied from interface:Header
Getter 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:Header
Getter for the Content Type "cty" claim defined in the JWT's Header. If the claim is missing it will return null.- Specified by:
getContentType
in interfaceHeader
- Returns:
- the Content Type defined or null.
-
getKeyId
Description copied from interface:Header
Get the value of the "kid" claim, or null if it's not available. -
getHeaderClaim
Description copied from interface:Header
Get a Private Claim given it's name. If the Claim wasn't specified in the Header, a NullClaim will be returned.- Specified by:
getHeaderClaim
in interfaceHeader
- Parameters:
name
- the name of the Claim to retrieve.- Returns:
- a non-null Claim.
-
getIssuer
Description copied from interface:Payload
Get the value of the "iss" claim, or null if it's not available. -
getSubject
Description copied from interface:Payload
Get the value of the "sub" claim, or null if it's not available.- Specified by:
getSubject
in interfacePayload
- Returns:
- the Subject value or null.
-
getAudience
Description copied from interface:Payload
Get the value of the "aud" claim, or null if it's not available.- Specified by:
getAudience
in interfacePayload
- Returns:
- the Audience value or null.
-
getExpiresAt
Description copied from interface:Payload
Get the value of the "exp" claim, or null if it's not available.- Specified by:
getExpiresAt
in interfacePayload
- Returns:
- the Expiration Time value or null.
-
getNotBefore
Description copied from interface:Payload
Get the value of the "nbf" claim, or null if it's not available.- Specified by:
getNotBefore
in interfacePayload
- Returns:
- the Not Before value or null.
-
getIssuedAt
Description copied from interface:Payload
Get the value of the "iat" claim, or null if it's not available.- Specified by:
getIssuedAt
in interfacePayload
- Returns:
- the Issued At value or null.
-
getId
Description copied from interface:Payload
Get the value of the "jti" claim, or null if it's not available. -
getClaim
Description copied from interface:Payload
Get 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:Payload
Get the Claims defined in the Token. -
getHeader
Description copied from interface:DecodedJWT
Getter for the Header contained in the JWT as a Base64 encoded String. This represents the first part of the token.- Specified by:
getHeader
in interfaceDecodedJWT
- Returns:
- the Header of the JWT.
-
getPayload
Description copied from interface:DecodedJWT
Getter for the Payload contained in the JWT as a Base64 encoded String. This represents the second part of the token.- Specified by:
getPayload
in interfaceDecodedJWT
- Returns:
- the Payload of the JWT.
-
getSignature
Description copied from interface:DecodedJWT
Getter for the Signature contained in the JWT as a Base64 encoded String. This represents the third part of the token.- Specified by:
getSignature
in interfaceDecodedJWT
- Returns:
- the Signature of the JWT.
-
getToken
Description copied from interface:DecodedJWT
Getter for the String Token used to create this JWT instance.- Specified by:
getToken
in interfaceDecodedJWT
- Returns:
- the String Token.
-