Class DefaultReactiveOAuth2AuthorizedClientManager
- java.lang.Object
-
- org.springframework.security.oauth2.client.web.DefaultReactiveOAuth2AuthorizedClientManager
-
- All Implemented Interfaces:
ReactiveOAuth2AuthorizedClientManager
public final class DefaultReactiveOAuth2AuthorizedClientManager extends java.lang.Object implements ReactiveOAuth2AuthorizedClientManager
The default implementation of aReactiveOAuth2AuthorizedClientManager
.- Since:
- 5.2
- See Also:
ReactiveOAuth2AuthorizedClientManager
,ReactiveOAuth2AuthorizedClientProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultReactiveOAuth2AuthorizedClientManager.DefaultContextAttributesMapper
The default implementation of thecontextAttributesMapper
.
-
Constructor Summary
Constructors Constructor Description DefaultReactiveOAuth2AuthorizedClientManager(ReactiveClientRegistrationRepository clientRegistrationRepository, ServerOAuth2AuthorizedClientRepository authorizedClientRepository)
Constructs aDefaultReactiveOAuth2AuthorizedClientManager
using the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<OAuth2AuthorizedClient>
authorize(OAuth2AuthorizeRequest authorizeRequest)
Attempt to authorize or re-authorize (if required) theclient
identified by the providedclientRegistrationId
.void
setAuthorizedClientProvider(ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider)
Sets theReactiveOAuth2AuthorizedClientProvider
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 theFunction
used for mapping attribute(s) from theOAuth2AuthorizeRequest
to aMap
of attributes to be associated to theauthorization context
.
-
-
-
Constructor Detail
-
DefaultReactiveOAuth2AuthorizedClientManager
public DefaultReactiveOAuth2AuthorizedClientManager(ReactiveClientRegistrationRepository clientRegistrationRepository, ServerOAuth2AuthorizedClientRepository authorizedClientRepository)
Constructs aDefaultReactiveOAuth2AuthorizedClientManager
using the provided parameters.- Parameters:
clientRegistrationRepository
- the repository of client registrationsauthorizedClientRepository
- the repository of authorized clients
-
-
Method Detail
-
authorize
public reactor.core.publisher.Mono<OAuth2AuthorizedClient> authorize(OAuth2AuthorizeRequest authorizeRequest)
Description copied from interface:ReactiveOAuth2AuthorizedClientManager
Attempt to authorize or re-authorize (if required) theclient
identified by the providedclientRegistrationId
. Implementations must return an emptyMono
if authorization is not supported for the specified client, e.g. the associatedReactiveOAuth2AuthorizedClientProvider
(s) does not support theauthorization 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. arefresh token
is not available OR theaccess token
is not expired.- Specified by:
authorize
in interfaceReactiveOAuth2AuthorizedClientManager
- Parameters:
authorizeRequest
- the authorize request- Returns:
- the
OAuth2AuthorizedClient
or an emptyMono
if authorization is not supported for the specified client
-
setAuthorizedClientProvider
public void setAuthorizedClientProvider(ReactiveOAuth2AuthorizedClientProvider authorizedClientProvider)
Sets theReactiveOAuth2AuthorizedClientProvider
used for authorizing (or re-authorizing) an OAuth 2.0 Client.- Parameters:
authorizedClientProvider
- theReactiveOAuth2AuthorizedClientProvider
used for authorizing (or re-authorizing) an OAuth 2.0 Client
-
setContextAttributesMapper
public void setContextAttributesMapper(java.util.function.Function<OAuth2AuthorizeRequest,reactor.core.publisher.Mono<java.util.Map<java.lang.String,java.lang.Object>>> contextAttributesMapper)
Sets theFunction
used for mapping attribute(s) from theOAuth2AuthorizeRequest
to aMap
of attributes to be associated to theauthorization context
.- Parameters:
contextAttributesMapper
- theFunction
used for supplying theMap
of attributes to theauthorization context
-
-