Package com.sap.cloud.security.token
Class AbstractToken
java.lang.Object
com.sap.cloud.security.token.AbstractToken
- All Implemented Interfaces:
Token,Serializable
- Direct Known Subclasses:
SapIdToken,XsuaaToken
Decodes and parses encoded JSON Web Token (JWT) and provides access to token header parameters and claims.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DefaultJsonObjectprotected final DefaultJsonObjectFields inherited from interface com.sap.cloud.security.token.Token
DEFAULT_TOKEN_FACTORY, services -
Constructor Summary
ConstructorsConstructorDescriptionAbstractToken(DecodedJwt decodedJwt) AbstractToken(String jwtToken) Creates a Token object for simple access to the header parameters and its claims. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrincipalcreatePrincipalByName(String name) booleangetClaimAsJsonObject(String claimName) getClaimAsString(String claimName) getClaimAsStringList(String claimName) getHeaderParameterAsString(String headerName) booleaninthashCode()booleanhasHeaderParameter(String parameterName) booleanbooleantoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sap.cloud.security.token.Token
getAppTid, getAttributeFromClaimAsString, getAttributeFromClaimAsStringList, getAudiences, getClientId, getGrantType, getIssuer, getPrincipal, getService, getZoneId
-
Field Details
-
tokenHeader
-
tokenBody
-
-
Constructor Details
-
AbstractToken
-
AbstractToken
Creates a Token object for simple access to the header parameters and its claims.- Parameters:
jwtToken- the encoded JWT token (access_token or id_token), e.g. from the Authorization Header.
-
-
Method Details
-
getHeaderParameterAsString
- Specified by:
getHeaderParameterAsStringin interfaceToken
-
hasClaim
-
hasHeaderParameter
- Specified by:
hasHeaderParameterin interfaceToken
-
getClaimAsString
- Specified by:
getClaimAsStringin interfaceToken
-
getClaimAsStringList
- Specified by:
getClaimAsStringListin interfaceToken
-
getClaimAsJsonObject
- Specified by:
getClaimAsJsonObjectin interfaceToken
-
getExpiration
- Specified by:
getExpirationin interfaceToken
-
isExpired
public boolean isExpired() -
getNotBefore
- Specified by:
getNotBeforein interfaceToken
-
getTokenValue
- Specified by:
getTokenValuein interfaceToken
-
isXsuaaToken
public boolean isXsuaaToken() -
createPrincipalByName
-
equals
-
hashCode
public int hashCode() -
toString
-
getHeaders
- Specified by:
getHeadersin interfaceToken
-
getClaims
-