public final class AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository extends java.lang.Object implements ServerOAuth2AuthorizedClientRepository
ServerOAuth2AuthorizedClientRepository
that delegates
to the provided ServerOAuth2AuthorizedClientRepository
if the current
Principal
is authenticated, otherwise, to the default (or provided)
ServerOAuth2AuthorizedClientRepository
if the current request is
unauthenticated (or anonymous). The default
ReactiveOAuth2AuthorizedClientRepository
is
WebSessionServerOAuth2AuthorizedClientRepository
.Constructor and Description |
---|
AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(ReactiveOAuth2AuthorizedClientService authorizedClientService)
Creates an instance
|
Modifier and Type | Method and Description |
---|---|
<T extends OAuth2AuthorizedClient> |
loadAuthorizedClient(java.lang.String clientRegistrationId,
Authentication principal,
org.springframework.web.server.ServerWebExchange exchange)
Returns the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner) or
null if not available. |
reactor.core.publisher.Mono<java.lang.Void> |
removeAuthorizedClient(java.lang.String clientRegistrationId,
Authentication principal,
org.springframework.web.server.ServerWebExchange exchange)
Removes the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner). |
reactor.core.publisher.Mono<java.lang.Void> |
saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient,
Authentication principal,
org.springframework.web.server.ServerWebExchange exchange)
Saves the
OAuth2AuthorizedClient associating it to the provided End-User
Authentication (Resource Owner). |
void |
setAnonymousAuthorizedClientRepository(ServerOAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)
Sets the
ServerOAuth2AuthorizedClientRepository used for requests that are
unauthenticated (or anonymous). |
public AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(ReactiveOAuth2AuthorizedClientService authorizedClientService)
authorizedClientService
- the authorized client servicepublic void setAnonymousAuthorizedClientRepository(ServerOAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)
ServerOAuth2AuthorizedClientRepository
used for requests that are
unauthenticated (or anonymous). The default is
WebSessionServerOAuth2AuthorizedClientRepository
.anonymousAuthorizedClientRepository
- the repository used for requests that
are unauthenticated (or anonymous)public <T extends OAuth2AuthorizedClient> reactor.core.publisher.Mono<T> loadAuthorizedClient(java.lang.String clientRegistrationId, Authentication principal, org.springframework.web.server.ServerWebExchange exchange)
ServerOAuth2AuthorizedClientRepository
OAuth2AuthorizedClient
associated to the provided client
registration identifier and End-User Authentication
(Resource Owner) or
null
if not available.loadAuthorizedClient
in interface ServerOAuth2AuthorizedClientRepository
T
- a type of OAuth2AuthorizedClientclientRegistrationId
- the identifier for the client's registrationprincipal
- the End-User Authentication
(Resource Owner)exchange
- the ServerWebExchange
OAuth2AuthorizedClient
or null
if not availablepublic reactor.core.publisher.Mono<java.lang.Void> saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal, org.springframework.web.server.ServerWebExchange exchange)
ServerOAuth2AuthorizedClientRepository
OAuth2AuthorizedClient
associating it to the provided End-User
Authentication
(Resource Owner).saveAuthorizedClient
in interface ServerOAuth2AuthorizedClientRepository
authorizedClient
- the authorized clientprincipal
- the End-User Authentication
(Resource Owner)exchange
- the ServerWebExchange
public reactor.core.publisher.Mono<java.lang.Void> removeAuthorizedClient(java.lang.String clientRegistrationId, Authentication principal, org.springframework.web.server.ServerWebExchange exchange)
ServerOAuth2AuthorizedClientRepository
OAuth2AuthorizedClient
associated to the provided client
registration identifier and End-User Authentication
(Resource Owner).removeAuthorizedClient
in interface ServerOAuth2AuthorizedClientRepository
clientRegistrationId
- the identifier for the client's registrationprincipal
- the End-User Authentication
(Resource Owner)exchange
- the ServerWebExchange