Class OAuth2AccessTokenGenerator
java.lang.Object
org.springframework.security.oauth2.server.authorization.token.OAuth2AccessTokenGenerator
- All Implemented Interfaces:
OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2AccessToken>
public final class OAuth2AccessTokenGenerator
extends Object
implements OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2AccessToken>
- Since:
- 0.2.3
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.oauth2.core.OAuth2AccessToken
generate
(OAuth2TokenContext context) Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext
, or returnnull
if theOAuth2TokenContext.getTokenType()
is not supported.void
setAccessTokenCustomizer
(OAuth2TokenCustomizer<OAuth2TokenClaimsContext> accessTokenCustomizer)
-
Constructor Details
-
OAuth2AccessTokenGenerator
public OAuth2AccessTokenGenerator()
-
-
Method Details
-
generate
@Nullable public org.springframework.security.oauth2.core.OAuth2AccessToken generate(OAuth2TokenContext context) Description copied from interface:OAuth2TokenGenerator
Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext
, or returnnull
if theOAuth2TokenContext.getTokenType()
is not supported.If the returned
OAuth2Token
has a set of claims, it should implementClaimAccessor
in order for it to be stored with theOAuth2Authorization
.- Specified by:
generate
in interfaceOAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2AccessToken>
- Parameters:
context
- the context containing the OAuth 2.0 Token attributes- Returns:
- an
OAuth2Token
ornull
if theOAuth2TokenContext.getTokenType()
is not supported
-
setAccessTokenCustomizer
public void setAccessTokenCustomizer(OAuth2TokenCustomizer<OAuth2TokenClaimsContext> accessTokenCustomizer) - Parameters:
accessTokenCustomizer
- theOAuth2TokenCustomizer
that customizes the claims for theOAuth2AccessToken
-