Package com.auth0.jwt
Class JWTDecoder
- java.lang.Object
-
- com.auth0.jwt.JWTDecoder
-
- All Implemented Interfaces:
DecodedJWT,Header,Payload
final class JWTDecoder extends java.lang.Object implements DecodedJWT
The JWTDecoder class holds the decode method to parse a given JWT token into it's JWT representation.
-
-
Constructor Summary
Constructors Constructor Description JWTDecoder(JWTParser converter, java.lang.String jwt)JWTDecoder(java.lang.String jwt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlgorithm()Getter for the Algorithm "alg" claim defined in the JWT's Header.java.util.List<java.lang.String>getAudience()Get the value of the "aud" claim, or null if it's not available.ClaimgetClaim(java.lang.String name)Get a Claim given it's name.java.util.Map<java.lang.String,Claim>getClaims()Get the Claims defined in the Token.java.lang.StringgetContentType()Getter for the Content Type "cty" claim defined in the JWT's Header.java.util.DategetExpiresAt()Get the value of the "exp" claim, or null if it's not available.java.lang.StringgetHeader()Getter for the Header contained in the JWT as a Base64 encoded String.ClaimgetHeaderClaim(java.lang.String name)Get a Private Claim given it's name.java.lang.StringgetId()Get the value of the "jti" claim, or null if it's not available.java.util.DategetIssuedAt()Get the value of the "iat" claim, or null if it's not available.java.lang.StringgetIssuer()Get the value of the "iss" claim, or null if it's not available.java.lang.StringgetKeyId()Get the value of the "kid" claim, or null if it's not available.java.util.DategetNotBefore()Get the value of the "nbf" claim, or null if it's not available.java.lang.StringgetPayload()Getter for the Payload contained in the JWT as a Base64 encoded String.java.lang.StringgetSignature()Getter for the Signature contained in the JWT as a Base64 encoded String.java.lang.StringgetSubject()Get the value of the "sub" claim, or null if it's not available.java.lang.StringgetToken()Getter for the String Token used to create this JWT instance.java.lang.StringgetType()Getter for the Type "typ" claim defined in the JWT's Header.
-
-
-
Constructor Detail
-
JWTDecoder
JWTDecoder(java.lang.String jwt) throws JWTDecodeException- Throws:
JWTDecodeException
-
JWTDecoder
JWTDecoder(JWTParser converter, java.lang.String jwt) throws JWTDecodeException
- Throws:
JWTDecodeException
-
-
Method Detail
-
getAlgorithm
public java.lang.String 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
public java.lang.String 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
public java.lang.String 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
public java.lang.String getKeyId()
Description copied from interface:HeaderGet the value of the "kid" claim, or null if it's not available.
-
getHeaderClaim
public Claim getHeaderClaim(java.lang.String name)
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
public java.lang.String getIssuer()
Description copied from interface:PayloadGet the value of the "iss" claim, or null if it's not available.
-
getSubject
public java.lang.String 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
public java.util.List<java.lang.String> 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
public java.util.Date 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
public java.util.Date 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
public java.util.Date 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
public java.lang.String getId()
Description copied from interface:PayloadGet the value of the "jti" claim, or null if it's not available.
-
getClaim
public Claim getClaim(java.lang.String name)
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
public java.util.Map<java.lang.String,Claim> getClaims()
Description copied from interface:PayloadGet the Claims defined in the Token.
-
getHeader
public java.lang.String 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
public java.lang.String 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
public java.lang.String 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
public java.lang.String getToken()
Description copied from interface:DecodedJWTGetter for the String Token used to create this JWT instance.- Specified by:
getTokenin interfaceDecodedJWT- Returns:
- the String Token.
-
-