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.OAuth2AccessTokengenerate(OAuth2TokenContext context) Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext, or returnnullif theOAuth2TokenContext.getTokenType()is not supported.voidsetAccessTokenCustomizer(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:OAuth2TokenGeneratorGenerate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext, or returnnullif theOAuth2TokenContext.getTokenType()is not supported.If the returned
OAuth2Tokenhas a set of claims, it should implementClaimAccessorin order for it to be stored with theOAuth2Authorization.- Specified by:
generatein interfaceOAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2AccessToken>- Parameters:
context- the context containing the OAuth 2.0 Token attributes- Returns:
- an
OAuth2Tokenornullif theOAuth2TokenContext.getTokenType()is not supported
-
setAccessTokenCustomizer
public void setAccessTokenCustomizer(OAuth2TokenCustomizer<OAuth2TokenClaimsContext> accessTokenCustomizer) - Parameters:
accessTokenCustomizer- theOAuth2TokenCustomizerthat customizes the claims for theOAuth2AccessToken
-