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 ofReactiveOAuth2AuthorizedClientServicethat uses aDatabaseClientforOAuth2AuthorizedClientpersistence.NOTE: This
ReactiveOAuth2AuthorizedClientServicedepends 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 classR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderA holder forOAuth2AuthorizedClientdata and End-UserAuthentication(Resource Owner).static classR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientParametersMapperThe defaultFunctionthat mapsR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter.static classR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientRowMapperThe defaultBiFunctionthat maps the currentio.r2dbc.spi.Rowto 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>>authorizedClientParametersMapperprotected java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder>authorizedClientRowMapperprotected ReactiveClientRegistrationRepositoryclientRegistrationRepositoryprotected org.springframework.r2dbc.core.DatabaseClientdatabaseClient
-
Constructor Summary
Constructors Constructor Description R2dbcReactiveOAuth2AuthorizedClientService(org.springframework.r2dbc.core.DatabaseClient databaseClient, ReactiveClientRegistrationRepository clientRegistrationRepository)Constructs aR2dbcReactiveOAuth2AuthorizedClientServiceusing 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 theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.reactor.core.publisher.Mono<java.lang.Void>removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.reactor.core.publisher.Mono<java.lang.Void>saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal)Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).voidsetAuthorizedClientParametersMapper(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.String,org.springframework.r2dbc.core.Parameter>> authorizedClientParametersMapper)Sets theFunctionused for mappingR2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolderto aMapofStringandParameter.voidsetAuthorizedClientRowMapper(java.util.function.BiFunction<io.r2dbc.spi.Row,io.r2dbc.spi.RowMetadata,R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder> authorizedClientRowMapper)Sets theBiFunctionused for mapping the currentio.r2dbc.spi.RowtoR2dbcReactiveOAuth2AuthorizedClientService.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 aR2dbcReactiveOAuth2AuthorizedClientServiceusing 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: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<java.lang.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<java.lang.Void> removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.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(java.util.function.Function<R2dbcReactiveOAuth2AuthorizedClientService.OAuth2AuthorizedClientHolder,java.util.Map<java.lang.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(java.util.function.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
-
-