public class R2dbcReactiveOAuth2AuthorizedClientService extends java.lang.Object implements ReactiveOAuth2AuthorizedClientService
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.
ReactiveOAuth2AuthorizedClientService
,
OAuth2AuthorizedClient
,
DatabaseClient
Modifier and Type | Class and Description |
---|---|
static class |
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
A holder for
OAuth2AuthorizedClient data and End-User
Authentication (Resource Owner). |
static class |
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper
The default
Function that maps R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder to a
Map of String and Parameter . |
static class |
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper
The default
BiFunction that maps the current io.r2dbc.spi.Row to a
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder . |
Modifier and Type | Field and 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 and Description |
---|
R2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient,
ReactiveClientRegistrationRepository clientRegistrationRepository)
Constructs a
R2dbcReactiveOAuth2AuthorizedClientService using the provided
parameters. |
Modifier and Type | Method and Description |
---|---|
<T extends OAuth2AuthorizedClient> |
loadAuthorizedClient(java.lang.String clientRegistrationId,
java.lang.String principalName)
Returns the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User's Principal name or null if
not available. |
reactor.core.publisher.Mono<java.lang.Void> |
removeAuthorizedClient(java.lang.String clientRegistrationId,
java.lang.String principalName)
Removes the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User's Principal name. |
reactor.core.publisher.Mono<java.lang.Void> |
saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient,
Authentication principal)
Saves the
OAuth2AuthorizedClient associating it to the provided End-User
Authentication (Resource Owner). |
void |
setAuthorizedClientParametersMapper(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper)
Sets the
Function used for mapping R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder to
a Map of String and Parameter . |
void |
setAuthorizedClientRowMapper(java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper)
Sets the
BiFunction used for mapping the current io.r2dbc.spi.Row
to R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder . |
protected final org.springframework.r2dbc.core.DatabaseClient databaseClient
protected final ReactiveClientRegistrationRepository clientRegistrationRepository
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
public R2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository)
R2dbcReactiveOAuth2AuthorizedClientService
using the provided
parameters.databaseClient
- the database clientclientRegistrationRepository
- the repository of client registrationspublic <T extends OAuth2AuthorizedClient> reactor.core.publisher.Mono<T> loadAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)
ReactiveOAuth2AuthorizedClientService
OAuth2AuthorizedClient
associated to the provided client
registration identifier and End-User's Principal
name or null
if
not available.loadAuthorizedClient
in interface ReactiveOAuth2AuthorizedClientService
T
- a type of OAuth2AuthorizedClientclientRegistrationId
- the identifier for the client's registrationprincipalName
- the name of the End-User Principal
(Resource Owner)OAuth2AuthorizedClient
or null
if not availablepublic reactor.core.publisher.Mono<java.lang.Void> saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal)
ReactiveOAuth2AuthorizedClientService
OAuth2AuthorizedClient
associating it to the provided End-User
Authentication
(Resource Owner).saveAuthorizedClient
in interface ReactiveOAuth2AuthorizedClientService
authorizedClient
- the authorized clientprincipal
- the End-User Authentication
(Resource Owner)public reactor.core.publisher.Mono<java.lang.Void> removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)
ReactiveOAuth2AuthorizedClientService
OAuth2AuthorizedClient
associated to the provided client
registration identifier and End-User's Principal
name.removeAuthorizedClient
in interface ReactiveOAuth2AuthorizedClientService
clientRegistrationId
- the identifier for the client's registrationprincipalName
- the name of the End-User Principal
(Resource Owner)public final void setAuthorizedClientParametersMapper(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper)
Function
used for mapping R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to
a Map
of String
and Parameter
. The default is
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapper
.authorizedClientParametersMapper
- the Function
used for mapping
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
to a Map
of String
and
Parameter
public final void setAuthorizedClientRowMapper(java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper)
BiFunction
used for mapping the current io.r2dbc.spi.Row
to R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder
. The default is
R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapper
.authorizedClientRowMapper
- the BiFunction
used for mapping the
current io.r2dbc.spi.Row
to R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder