Class DelegatingOAuth2TokenGenerator
java.lang.Object
org.springframework.security.oauth2.server.authorization.token.DelegatingOAuth2TokenGenerator
- All Implemented Interfaces:
OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2Token>
public final class DelegatingOAuth2TokenGenerator
extends Object
implements OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2Token>
An
OAuth2TokenGenerator that simply delegates to it's internal List of
OAuth2TokenGenerator(s).
Each OAuth2TokenGenerator is given a chance to
OAuth2TokenGenerator.generate(OAuth2TokenContext) with the first
non-null OAuth2Token being returned.
- Since:
- 0.2.3
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDelegatingOAuth2TokenGenerator(OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token>... tokenGenerators) Constructs aDelegatingOAuth2TokenGeneratorusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.oauth2.core.OAuth2Tokengenerate(OAuth2TokenContext context) Generate an OAuth 2.0 Token using the attributes contained in theOAuth2TokenContext, or returnnullif theOAuth2TokenContext.getTokenType()is not supported.
-
Constructor Details
-
DelegatingOAuth2TokenGenerator
@SafeVarargs public DelegatingOAuth2TokenGenerator(OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token>... tokenGenerators) Constructs aDelegatingOAuth2TokenGeneratorusing the provided parameters.- Parameters:
tokenGenerators- an array ofOAuth2TokenGenerator(s)
-
-
Method Details
-
generate
@Nullable public org.springframework.security.oauth2.core.OAuth2Token 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.OAuth2Token>- Parameters:
context- the context containing the OAuth 2.0 Token attributes- Returns:
- an
OAuth2Tokenornullif theOAuth2TokenContext.getTokenType()is not supported
-