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:
-
ReactiveOAuth2AuthorizedClientService
OAuth2AuthorizedClient
DatabaseClient
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A holder forOAuth2AuthorizedClient
data and End-UserAuthentication
(Resource Owner).static class
The defaultFunction
that mapsR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
.static class
The defaultBiFunction
that maps the currentio.r2dbc.spi.Row
to aR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
. -
Field Summary
Modifier 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 ReactiveClientRegistrationRepository
protected final org.springframework.r2dbc.core.DatabaseClient
-
Constructor Summary
ConstructorDescriptionR2dbcReactiveOAuth2AuthorizedClientService
(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository) Constructs aR2dbcReactiveOAuth2AuthorizedClientService
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescription<T extends OAuth2AuthorizedClient>
reactor.core.publisher.Mono<T>loadAuthorizedClient
(String clientRegistrationId, String principalName) Returns theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name ornull
if not available.reactor.core.publisher.Mono<Void>
removeAuthorizedClient
(String clientRegistrationId, String principalName) Removes theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name.reactor.core.publisher.Mono<Void>
saveAuthorizedClient
(OAuth2AuthorizedClient authorizedClient, Authentication principal) Saves theOAuth2AuthorizedClient
associating it to the provided End-UserAuthentication
(Resource Owner).final void
setAuthorizedClientParametersMapper
(Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder, Map<String, org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper) Sets theFunction
used for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
.final void
setAuthorizedClientRowMapper
(BiFunction<io.r2dbc.spi.Row, io.r2dbc.spi.RowMetadata, R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper) Sets theBiFunction
used for mapping the currentio.r2dbc.spi.Row
toR2dbcReactiveOAuth2AuthorizedClientService.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 aR2dbcReactiveOAuth2AuthorizedClientService
using 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:ReactiveOAuth2AuthorizedClientService
Returns theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name ornull
if not available.- Specified by:
loadAuthorizedClient
in 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
OAuth2AuthorizedClient
ornull
if not available
-
saveAuthorizedClient
public reactor.core.publisher.Mono<Void> saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal) Description copied from interface:ReactiveOAuth2AuthorizedClientService
Saves theOAuth2AuthorizedClient
associating it to the provided End-UserAuthentication
(Resource Owner).- Specified by:
saveAuthorizedClient
in 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:ReactiveOAuth2AuthorizedClientService
Removes theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name.- Specified by:
removeAuthorizedClient
in 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 theFunction
used for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
. The default isR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper
.- Parameters:
authorizedClientParametersMapper
- theFunction
used for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
-
setAuthorizedClientRowMapper
public final void setAuthorizedClientRowMapper(BiFunction<io.r2dbc.spi.Row, io.r2dbc.spi.RowMetadata, R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper) Sets theBiFunction
used for mapping the currentio.r2dbc.spi.Row
toR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
. The default isR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper
.- Parameters:
authorizedClientRowMapper
- theBiFunction
used for mapping the currentio.r2dbc.spi.Row
toR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
-