public final class AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager extends java.lang.Object implements ReactiveOAuth2AuthorizedClientManager
ReactiveOAuth2AuthorizedClientManager
that is capable of operating outside of a ServerHttpRequest context,
e.g. in a scheduled/background thread and/or in the service-tier.
This is a reactive equivalent of AuthorizedClientServiceOAuth2AuthorizedClientManager
| Modifier and Type | Class and Description |
|---|---|
static class |
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.DefaultContextAttributesMapper
The default implementation of the
contextAttributesMapper. |
| Constructor and Description |
|---|
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(ReactiveClientRegistrationRepository clientRegistrationRepository,
ReactiveOAuth2AuthorizedClientService authorizedClientService)
Constructs an
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<OAuth2AuthorizedClient> |
authorize(OAuth2AuthorizeRequest authorizeRequest)
Attempt to authorize or re-authorize (if required) the
client
identified by the provided clientRegistrationId. |
void |
setAuthorizedClientProvider(ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider)
Sets the
ReactiveOAuth2AuthorizedClientProvider used for authorizing (or re-authorizing) an OAuth 2.0 Client. |
void |
setContextAttributesMapper(java.util.function.Function<OAuth2AuthorizeRequest,reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.Object>>> contextAttributesMapper)
Sets the
Function used for mapping attribute(s) from the OAuth2AuthorizeRequest to a Map of attributes
to be associated to the authorization context. |
public AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(ReactiveClientRegistrationRepository clientRegistrationRepository, ReactiveOAuth2AuthorizedClientService authorizedClientService)
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager using the provided parameters.clientRegistrationRepository - the repository of client registrationsauthorizedClientService - the authorized client servicepublic reactor.core.publisher.Mono<OAuth2AuthorizedClient> authorize(OAuth2AuthorizeRequest authorizeRequest)
ReactiveOAuth2AuthorizedClientManagerclient
identified by the provided clientRegistrationId.
Implementations must return an empty Mono if authorization is not supported for the specified client,
e.g. the associated ReactiveOAuth2AuthorizedClientProvider(s) does not support
the authorization grant type configured for the client.
In the case of re-authorization, implementations must return the provided authorized client
if re-authorization is not supported for the client OR is not required,
e.g. a refresh token is not available OR
the access token is not expired.
authorize in interface ReactiveOAuth2AuthorizedClientManagerauthorizeRequest - the authorize requestOAuth2AuthorizedClient or an empty Mono if authorization is not supported for the specified clientpublic void setAuthorizedClientProvider(ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider)
ReactiveOAuth2AuthorizedClientProvider used for authorizing (or re-authorizing) an OAuth 2.0 Client.authorizedClientProvider - the ReactiveOAuth2AuthorizedClientProvider used for authorizing (or re-authorizing) an OAuth 2.0 Clientpublic void setContextAttributesMapper(java.util.function.Function<OAuth2AuthorizeRequest,reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.Object>>> contextAttributesMapper)
Function used for mapping attribute(s) from the OAuth2AuthorizeRequest to a Map of attributes
to be associated to the authorization context.contextAttributesMapper - the Function used for supplying the Map of attributes
to the authorization context