Package com.sap.cloud.security.token
Class XsuaaToken
java.lang.Object
com.sap.cloud.security.token.AbstractToken
com.sap.cloud.security.token.XsuaaToken
- All Implemented Interfaces:
AccessToken,Token,Serializable
Decodes and parses encoded access token (JWT) for the Xsuaa identity service
and provides access to token header parameters and claims.
- See Also:
-
Field Summary
Fields inherited from class com.sap.cloud.security.token.AbstractToken
tokenBody, tokenHeaderFields inherited from interface com.sap.cloud.security.token.Token
DEFAULT_TOKEN_FACTORY, services -
Constructor Summary
ConstructorsConstructorDescriptionXsuaaToken(DecodedJwt decodedJwt) Creates an instance.XsuaaToken(String accessToken) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of the subdomain (zdn) from the external attribute ext_attr (ext_attr) claim.booleanhasLocalScope(String scope) Check if a local scope is available in the authentication token.booleanwithScopeConverter(ScopeConverter converter) Configures a scope converter, e.g.Methods inherited from class com.sap.cloud.security.token.AbstractToken
createPrincipalByName, equals, getClaimAsJsonObject, getClaimAsString, getClaimAsStringList, getClaims, getExpiration, getHeaderParameterAsString, getHeaders, getNotBefore, getTokenValue, hasClaim, hashCode, hasHeaderParameter, isExpired, isXsuaaToken, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sap.cloud.security.token.AccessToken
getAttributeFromClaimAsStringMethods inherited from interface com.sap.cloud.security.token.Token
getAttributeFromClaimAsStringList, getAudiences, getClaimAsJsonObject, getClaimAsString, getClaimAsStringList, getClaims, getExpiration, getHeaderParameterAsString, getHeaders, getIssuer, getNotBefore, getTokenValue, hasClaim, hasHeaderParameter, isExpired
-
Constructor Details
-
XsuaaToken
Creates an instance.- Parameters:
decodedJwt- the decoded jwt
-
XsuaaToken
Creates an instance.- Parameters:
accessToken- the encoded access token, e.g. from theAuthorizationheader.
-
-
Method Details
-
withScopeConverter
Configures a scope converter, e.g. required for thehasLocalScope(String)- Parameters:
converter- the scope converter, e.g.XsuaaScopeConverter- Returns:
- the token itself
-
getScopes
- Specified by:
getScopesin interfaceAccessToken
-
getPrincipal
- Specified by:
getPrincipalin interfaceToken
-
getService
- Specified by:
getServicein interfaceToken
-
hasScope
- Specified by:
hasScopein interfaceAccessToken
-
hasLocalScope
Check if a local scope is available in the authentication token.
Requires aScopeConverterto be configured withwithScopeConverter(ScopeConverter).- Specified by:
hasLocalScopein interfaceAccessToken- Parameters:
scope- name of local scope (without the appId)- Returns:
- true if local scope is available
-
getGrantType
- Specified by:
getGrantTypein interfaceToken
-
getSubdomain
Returns the value of the subdomain (zdn) from the external attribute ext_attr (ext_attr) claim. If the external attribute or the subdomain is missing, it returnsnull.- Returns:
- the subdomain or
null
-
getSubaccountId
- Specified by:
getSubaccountIdin interfaceAccessToken
-
getZoneId
-
getAppTid
-
getClientId
- Specified by:
getClientIdin interfaceToken
-