Class R2dbcReactiveOAuth2AuthorizedClientService
java.lang.Object
org.springframework.security.oauth2.client.R2dbcReactiveOAuth2AuthorizedClientService
- All Implemented Interfaces:
ReactiveOAuth2AuthorizedClientService
public class R2dbcReactiveOAuth2AuthorizedClientService
extends Object
implements ReactiveOAuth2AuthorizedClientService
A R2DBC implementation of
ReactiveOAuth2AuthorizedClientService that uses a
DatabaseClient for OAuth2AuthorizedClient persistence.
NOTE: This ReactiveOAuth2AuthorizedClientService depends on the table
definition described in
"classpath:org/springframework/security/oauth2/client/oauth2-client-schema.sql" and
therefore MUST be defined in the database schema.
- Since:
- 5.5
- See Also:
-
ReactiveOAuth2AuthorizedClientServiceOAuth2AuthorizedClientDatabaseClient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA holder forOAuth2AuthorizedClientdata and End-UserAuthentication(Resource Owner).static classThe defaultFunctionthat mapsR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter.static classThe defaultBiFunctionthat maps the currentio.r2dbc.spi.Rowto aR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,Map<String, org.springframework.r2dbc.core.Parameter>> protected BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata, R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> protected final ReactiveClientRegistrationRepositoryprotected final org.springframework.r2dbc.core.DatabaseClient -
Constructor Summary
ConstructorsConstructorDescriptionR2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs aR2dbcReactiveOAuth2AuthorizedClientServiceusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescription<T extends OAuth2AuthorizedClient>
reactor.core.publisher.Mono<T>loadAuthorizedClient(String clientRegistrationId, String principalName) Returns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.reactor.core.publisher.Mono<Void>removeAuthorizedClient(String clientRegistrationId, String principalName) Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.reactor.core.publisher.Mono<Void>saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal) Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).final voidsetAuthorizedClientParametersMapper(Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder, Map<String, org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper) Sets theFunctionused for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter.final voidsetAuthorizedClientRowMapper(BiFunction<io.r2dbc.spi.Row, io.r2dbc.spi.RowMetadata, R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper) Sets theBiFunctionused for mapping the currentio.r2dbc.spi.RowtoR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder.
-
Field Details
-
databaseClient
protected final org.springframework.r2dbc.core.DatabaseClient databaseClient -
clientRegistrationRepository
-
authorizedClientParametersMapper
protected Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,Map<String, authorizedClientParametersMapperorg.springframework.r2dbc.core.Parameter>> -
authorizedClientRowMapper
protected BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata, authorizedClientRowMapperR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder>
-
-
Constructor Details
-
R2dbcReactiveOAuth2AuthorizedClientService
public R2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs aR2dbcReactiveOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
databaseClient- the database clientclientRegistrationRepository- the repository of client registrations
-
-
Method Details
-
loadAuthorizedClient
public <T extends OAuth2AuthorizedClient> reactor.core.publisher.Mono<T> loadAuthorizedClient(String clientRegistrationId, String principalName) Description copied from interface:ReactiveOAuth2AuthorizedClientServiceReturns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.- Specified by:
loadAuthorizedClientin interfaceReactiveOAuth2AuthorizedClientService- Type Parameters:
T- a type of OAuth2AuthorizedClient- Parameters:
clientRegistrationId- the identifier for the client's registrationprincipalName- the name of the End-UserPrincipal(Resource Owner)- Returns:
- the
OAuth2AuthorizedClientornullif not available
-
saveAuthorizedClient
public reactor.core.publisher.Mono<Void> saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal) Description copied from interface:ReactiveOAuth2AuthorizedClientServiceSaves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).- Specified by:
saveAuthorizedClientin interfaceReactiveOAuth2AuthorizedClientService- Parameters:
authorizedClient- the authorized clientprincipal- the End-UserAuthentication(Resource Owner)
-
removeAuthorizedClient
public reactor.core.publisher.Mono<Void> removeAuthorizedClient(String clientRegistrationId, String principalName) Description copied from interface:ReactiveOAuth2AuthorizedClientServiceRemoves theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.- Specified by:
removeAuthorizedClientin interfaceReactiveOAuth2AuthorizedClientService- Parameters:
clientRegistrationId- the identifier for the client's registrationprincipalName- the name of the End-UserPrincipal(Resource Owner)
-
setAuthorizedClientParametersMapper
public final void setAuthorizedClientParametersMapper(Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder, Map<String, org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper) Sets theFunctionused for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter. The default isR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper.- Parameters:
authorizedClientParametersMapper- theFunctionused for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter
-
setAuthorizedClientRowMapper
public final void setAuthorizedClientRowMapper(BiFunction<io.r2dbc.spi.Row, io.r2dbc.spi.RowMetadata, R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper) Sets theBiFunctionused for mapping the currentio.r2dbc.spi.RowtoR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder. The default isR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper.- Parameters:
authorizedClientRowMapper- theBiFunctionused for mapping the currentio.r2dbc.spi.RowtoR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
-