Class OAuth2AccessToken
- java.lang.Object
-
- org.springframework.security.oauth2.core.AbstractOAuth2Token
-
- org.springframework.security.oauth2.core.OAuth2AccessToken
-
- africa.absa.inception.oauth2.server.authorization.token.OAuth2AccessToken
-
- All Implemented Interfaces:
Serializable,org.springframework.security.oauth2.core.OAuth2Token
public class OAuth2AccessToken extends org.springframework.security.oauth2.core.OAuth2AccessTokenThe OAuth2AccessToken holds the information for an OAuth2 access token.- Author:
- Marcus Portmann
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFUNCTIONS_CLAIMThe name of the functions claim that provides the functions assigned to the user.static StringNAME_CLAIMThe name of the claim that provides the name of the user.static StringROLES_CLAIMThe name of the roles claim that provides the roles assigned to the user.static StringSCOPE_CLAIMThe name of the scope claim.static StringTENANTS_CLAIMThe name of the tenants claim that provides the Universally Unique Identifiers (UUIDs) for the tenants the user is associated with.static StringUSER_DIRECTORY_ID_CLAIMThe name of the user directory ID claim that provides the Universally Unique Identifier (UUID) for the user directory the user is associated with.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OAuth2AccessTokenbuild(User user, List<String> roleCodes, List<String> functionCodes, List<UUID> tenantIds, Set<String> scopes, String issuer, int validFor, RSAPrivateKey rsaPrivateKey)Build a new OAuth2AccessToken.longgetExpiresIn()Returns the lifetime in seconds of the access token.StringgetSubject()Returns the subject for the token.-
Methods inherited from class org.springframework.security.oauth2.core.OAuth2AccessToken
getScopes, getTokenType
-
-
-
-
Field Detail
-
FUNCTIONS_CLAIM
public static final String FUNCTIONS_CLAIM
The name of the functions claim that provides the functions assigned to the user.- See Also:
- Constant Field Values
-
NAME_CLAIM
public static final String NAME_CLAIM
The name of the claim that provides the name of the user.- See Also:
- Constant Field Values
-
ROLES_CLAIM
public static final String ROLES_CLAIM
The name of the roles claim that provides the roles assigned to the user.- See Also:
- Constant Field Values
-
SCOPE_CLAIM
public static final String SCOPE_CLAIM
The name of the scope claim.- See Also:
- Constant Field Values
-
TENANTS_CLAIM
public static final String TENANTS_CLAIM
The name of the tenants claim that provides the Universally Unique Identifiers (UUIDs) for the tenants the user is associated with.- See Also:
- Constant Field Values
-
USER_DIRECTORY_ID_CLAIM
public static final String USER_DIRECTORY_ID_CLAIM
The name of the user directory ID claim that provides the Universally Unique Identifier (UUID) for the user directory the user is associated with.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OAuth2AccessToken
public OAuth2AccessToken(org.springframework.security.oauth2.core.OAuth2AccessToken.TokenType tokenType, String tokenValue, String subject, Instant issuedAt, Instant expiresAt, Set<String> scopes)Constructs a new OAuth2AccessToken.- Parameters:
tokenType- the token typetokenValue- the token valuesubject- the subject for the tokenissuedAt- the time at which the token was issuedexpiresAt- the expiration time on or after which the token MUST NOT be acceptedscopes- the scope(s) associated to the token
-
-
Method Detail
-
build
public static OAuth2AccessToken build(User user, List<String> roleCodes, List<String> functionCodes, List<UUID> tenantIds, Set<String> scopes, String issuer, int validFor, RSAPrivateKey rsaPrivateKey)
Build a new OAuth2AccessToken.- Parameters:
user- the User the token is being issued forroleCodes- the role codes for the user the token is being issued forfunctionCodes- the function codes for the user the token is being issued fortenantIds- the IDs for the tenants that the user the token is being issued for is associated withscopes- the optional scope(s) associated to the tokenissuer- the optional issuer of the token, which can be nullvalidFor- the number of seconds the token should be valid forrsaPrivateKey- the RSA private key used to sign the token- Returns:
- the OAuth2 access token
-
getExpiresIn
public long getExpiresIn()
Returns the lifetime in seconds of the access token.- Returns:
- the lifetime in seconds of the access token
-
getSubject
public String getSubject()
Returns the subject for the token.- Returns:
- the subject for the token
-
-