public final class DelegatingOAuth2TokenGenerator extends java.lang.Object implements OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2Token>
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.
OAuth2TokenGenerator,
JwtGenerator,
OAuth2RefreshTokenGenerator| Constructor and Description |
|---|
DelegatingOAuth2TokenGenerator(OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token>... tokenGenerators)
Constructs a
DelegatingOAuth2TokenGenerator using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.security.oauth2.core.OAuth2Token |
generate(OAuth2TokenContext context)
Generate an OAuth 2.0 Token using the attributes contained in the
OAuth2TokenContext,
or return null if the OAuth2TokenContext.getTokenType() is not supported. |
@SafeVarargs public DelegatingOAuth2TokenGenerator(OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token>... tokenGenerators)
DelegatingOAuth2TokenGenerator using the provided parameters.tokenGenerators - an array of OAuth2TokenGenerator(s)@Nullable public org.springframework.security.oauth2.core.OAuth2Token generate(OAuth2TokenContext context)
OAuth2TokenGeneratorOAuth2TokenContext,
or return null if the OAuth2TokenContext.getTokenType() is not supported.
If the returned OAuth2Token has a set of claims, it should implement ClaimAccessor
in order for it to be stored with the OAuth2Authorization.
generate in interface OAuth2TokenGenerator<org.springframework.security.oauth2.core.OAuth2Token>context - the context containing the OAuth 2.0 Token attributesOAuth2Token or null if the OAuth2TokenContext.getTokenType() is not supported