Class XsuaaTokenComp
java.lang.Object
com.sap.cloud.security.comp.XsuaaTokenComp
- All Implemented Interfaces:
Token,Serializable,org.springframework.security.core.userdetails.UserDetails
Deprecated.
Decorates a
Token issued by xsuaa to provide compatibility methods for spring-xsuaa's Token
interface.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic XsuaaTokenCompcreateInstance(Token token) Deprecated.use methods exposed by theTokeninterface.static XsuaaTokenCompcreateInstance(String jwtToken) Deprecated.use methods exposed by theTokeninterface.getAdditionalAuthAttribute(String attributeName) Deprecated.Deprecated.useToken.getTokenValue()insteadCollection<? extends org.springframework.security.core.GrantedAuthority> Deprecated.Deprecated.useToken.getClientId()instead.Deprecated.getEmail()Deprecated.useToken.getClaimAsString(String)insteadDeprecated.useToken.getExpiration()insteadDeprecated.useToken.getExpiration()insteadDeprecated.useToken.getClaimAsString(String)insteadDeprecated.useToken.getClaimAsString(String)insteadDeprecated.useToken.getGrantType()instead.Deprecated.useToken.getClaimAsString(String)instead.Deprecated.useToken.getClaimAsString(String)insteadDeprecated.Deprecated.useToken.getClaimAsStringList(String)insteadDeprecated.useAccessToken.getSubaccountId()instead.Deprecated.Deprecated.useToken.getPrincipal().getName()insteadString[]getXSUserAttribute(String attributeName) Deprecated.useToken.getAttributeFromClaimAsStringList(String, String)(String)} insteadDeprecated.useToken.getZoneId()instead.booleanDeprecated.booleanDeprecated.booleanDeprecated.booleanDeprecated.toString()Deprecated.useToken.getPrincipal().getName()instead
-
Method Details
-
createInstance
Deprecated.use methods exposed by theTokeninterface.Creates an instance.- Parameters:
token- a token issued by xsuaa
-
createInstance
Deprecated.use methods exposed by theTokeninterface.Creates an instance.- Parameters:
jwtToken- the encoded access token, e.g. from theAuthorizationheader.
-
getSubaccountId
Deprecated.useAccessToken.getSubaccountId()instead.Return subaccount identifier which is in most cases same like the identity zone. DO only use this for metering purposes. DO NOT longer use this method to get the unique tenant id! For that usegetZoneId().- Specified by:
getSubaccountIdin interfaceToken- Returns:
- the subaccount identifier.
-
getZoneId
Deprecated.useToken.getZoneId()instead.Return zone identifier which should be used as tenant discriminator (tenant id). For most of the old subaccounts this matches the id returned bygetSubaccountId(). -
getSubdomain
Deprecated.Returns the subdomain of the calling tenant's subaccount.- Specified by:
getSubdomainin interfaceToken- Returns:
- the subdomain of the tenant the JWT belongs to.
-
getClientId
Deprecated.useToken.getClientId()instead.Returns the OAuth2 client identifier of the authentication token if present. Following OpenID Connect 1.0 standard specifications, client identifier is obtained from "azp" claim if present or when "azp" is not present from "aud" claim, but only in case there is one audience.- Specified by:
getClientIdin interfaceToken- Returns:
- the OAuth client ID.
-
getGrantType
Deprecated.useToken.getGrantType()instead.Returns the OAuth2.0 grant type used for retrieving / creating this token.- Specified by:
getGrantTypein interfaceToken- Returns:
- the grant type
-
getLogonName
Deprecated.useToken.getClaimAsString(String)instead.Returns a unique user name of a user (user_nameclaim), using information from the JWT. For tokens that were issued as a result of a client credentials flow, the OAuth client ID will be returned in a special format. The following information is required to uniquely identify a user:
- user login name: name of the user in an identity provider, provided by this method.
- origin: alias to an identity provider, see
getOrigin(). - zone id: identifier for the zone, see
getZoneId().
- Specified by:
getLogonNamein interfaceToken- Returns:
- unique principal name or null if it can not be determined.
-
getGivenName
Deprecated.useToken.getClaimAsString(String)insteadReturns the given name of the user if present. Will try to find it first in theext_attr.given_nameclaim before trying to find agiven_nameclaim.- Specified by:
getGivenNamein interfaceToken- Returns:
- the given name if present.
-
getFamilyName
Deprecated.useToken.getClaimAsString(String)insteadReturns the family name of the user if present. Will try to find it first in theext_attr.family_nameclaim before trying to find afamily_nameclaim.- Specified by:
getFamilyNamein interfaceToken- Returns:
- the family name if present.
-
getEmail
Deprecated.useToken.getClaimAsString(String)insteadReturns the email address of the user, if present. -
getOrigin
Deprecated.useToken.getClaimAsString(String)insteadReturns the user origin. The origin is an alias that refers to a user store in which the user is persisted. For example, users that are authenticated by the UAA itself with a username / password combination have their origin set to the value "uaa".May be null in case this JWT was not created with OAuth 2.0 client credentials flow.
-
getXSUserAttribute
Deprecated.useToken.getAttributeFromClaimAsStringList(String, String)(String)} insteadReturns the value of an attribute from the 'xs.user.attributes' claim.- Specified by:
getXSUserAttributein interfaceToken- Parameters:
attributeName- name of the attribute inside 'xs.user.attributes'.- Returns:
- the attribute values array or null if there exists no such attribute.
-
getAdditionalAuthAttribute
Deprecated.Additional custom authentication attributes included by the OAuth client component. Note: this is data controlled by the requester of a token. Might be not trustworthy.- Specified by:
getAdditionalAuthAttributein interfaceToken- Parameters:
attributeName- name of the authentication attribute- Returns:
- additional attribute value if present.
-
getCloneServiceInstanceId
Deprecated.Returns the XSUAA clone instance ID, if present. This will only be set for tokens that were issued by an XSUAA with plan broker. Contains the service instance id if present.- Specified by:
getCloneServiceInstanceIdin interfaceToken- Returns:
- the XSUAA clone service instance id if present.
-
getAppToken
Deprecated.useToken.getTokenValue()insteadGet the encoded authentication token, e.g. for token forwarding to another app.Never expose this token via log or via HTTP.
- Specified by:
getAppTokenin interfaceToken- Returns:
- token
-
getScopes
Deprecated.useToken.getClaimAsStringList(String)insteadReturns list of scopes with appId prefix, e.g. "<my-app!t123>.Display". -
getAuthorities
@Deprecated public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()Deprecated.- Specified by:
getAuthoritiesin interfaceToken- Specified by:
getAuthoritiesin interfaceorg.springframework.security.core.userdetails.UserDetails- Throws:
UnsupportedOperationException- in any case
-
getPassword
Deprecated.- Specified by:
getPasswordin interfaceorg.springframework.security.core.userdetails.UserDetails- Throws:
UnsupportedOperationException- in any case
-
getExpiration
Deprecated.useToken.getExpiration()insteadReturns the moment in time when the token is expired.- Specified by:
getExpirationin interfaceToken- Returns:
- the expiration point in time if present.
-
getExpirationDate
Deprecated.useToken.getExpiration()insteadReturns the moment in time when the token is expired.- Returns:
- the expiration point in time if present.
-
getUsername
Deprecated.useToken.getPrincipal().getName()insteadReturns the username used to authenticate the user. Seeimport org.springframework.security.core.userdetails.UserDetails#getUsername()- Specified by:
getUsernamein interfaceorg.springframework.security.core.userdetails.UserDetails- Returns:
- the username
-
isAccountNonExpired
Deprecated.- Specified by:
isAccountNonExpiredin interfaceorg.springframework.security.core.userdetails.UserDetails
-
isAccountNonLocked
Deprecated.- Specified by:
isAccountNonLockedin interfaceorg.springframework.security.core.userdetails.UserDetails
-
isCredentialsNonExpired
Deprecated.- Specified by:
isCredentialsNonExpiredin interfaceorg.springframework.security.core.userdetails.UserDetails
-
isEnabled
Deprecated.- Specified by:
isEnabledin interfaceorg.springframework.security.core.userdetails.UserDetails
-
toString
Deprecated.useToken.getPrincipal().getName()insteadReturns the user name for token.
-
Tokeninterface.