Class R2dbcReactiveOAuth2AuthorizedClientService
- java.lang.Object
-
- org.springframework.security.oauth2.client.R2dbcReactiveOAuth2AuthorizedClientService
-
- All Implemented Interfaces:
ReactiveOAuth2AuthorizedClientService
public class R2dbcReactiveOAuth2AuthorizedClientService extends java.lang.Object implements ReactiveOAuth2AuthorizedClientService
A R2DBC implementation ofReactiveOAuth2AuthorizedClientService
that uses aDatabaseClient
forOAuth2AuthorizedClient
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
Nested Classes Modifier and Type Class Description static class
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
A holder forOAuth2AuthorizedClient
data and End-UserAuthentication
(Resource Owner).static class
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper
The defaultFunction
that mapsR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
.static class
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper
The defaultBiFunction
that maps the currentio.r2dbc.spi.Row
to aR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>>
authorizedClientParametersMapper
protected java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder>
authorizedClientRowMapper
protected ReactiveClientRegistrationRepository
clientRegistrationRepository
protected org.springframework.r2dbc.core.DatabaseClient
databaseClient
-
Constructor Summary
Constructors Constructor Description R2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository)
Constructs aR2dbcReactiveOAuth2AuthorizedClientService
using the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends OAuth2AuthorizedClient>
reactor.core.publisher.Mono<T>loadAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)
Returns theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name ornull
if not available.reactor.core.publisher.Mono<java.lang.Void>
removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)
Removes theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name.reactor.core.publisher.Mono<java.lang.Void>
saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal)
Saves theOAuth2AuthorizedClient
associating it to the provided End-UserAuthentication
(Resource Owner).void
setAuthorizedClientParametersMapper(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper)
Sets theFunction
used for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to aMap
ofString
andParameter
.void
setAuthorizedClientRowMapper(java.util.function.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 Detail
-
databaseClient
protected final org.springframework.r2dbc.core.DatabaseClient databaseClient
-
clientRegistrationRepository
protected final ReactiveClientRegistrationRepository clientRegistrationRepository
-
authorizedClientParametersMapper
protected java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper
-
authorizedClientRowMapper
protected java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper
-
-
Constructor Detail
-
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 Detail
-
loadAuthorizedClient
public <T extends OAuth2AuthorizedClient> reactor.core.publisher.Mono<T> loadAuthorizedClient(java.lang.String clientRegistrationId, java.lang.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<java.lang.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<java.lang.Void> removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.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(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.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(java.util.function.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
-
-