Class AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
- java.lang.Object
-
- org.springframework.security.oauth2.client.web.server.AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
-
- All Implemented Interfaces:
ServerOAuth2AuthorizedClientRepository
public final class AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository extends java.lang.Object implements ServerOAuth2AuthorizedClientRepository
An implementation of anServerOAuth2AuthorizedClientRepositorythat delegates to the providedServerOAuth2AuthorizedClientRepositoryif the currentPrincipalis authenticated, otherwise, to the default (or provided)ServerOAuth2AuthorizedClientRepositoryif the current request is unauthenticated (or anonymous). The defaultReactiveOAuth2AuthorizedClientRepositoryisWebSessionServerOAuth2AuthorizedClientRepository.
-
-
Constructor Summary
Constructors Constructor Description AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(ReactiveOAuth2AuthorizedClientService authorizedClientService)Creates an instance
-
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, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)Returns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-UserAuthentication(Resource Owner) ornullif not available.reactor.core.publisher.Mono<java.lang.Void>removeAuthorizedClient(java.lang.String clientRegistrationId, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-UserAuthentication(Resource Owner).reactor.core.publisher.Mono<java.lang.Void>saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).voidsetAnonymousAuthorizedClientRepository(ServerOAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)Sets theServerOAuth2AuthorizedClientRepositoryused for requests that are unauthenticated (or anonymous).
-
-
-
Constructor Detail
-
AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
public AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository(ReactiveOAuth2AuthorizedClientService authorizedClientService)
Creates an instance- Parameters:
authorizedClientService- the authorized client service
-
-
Method Detail
-
setAnonymousAuthorizedClientRepository
public void setAnonymousAuthorizedClientRepository(ServerOAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)
Sets theServerOAuth2AuthorizedClientRepositoryused for requests that are unauthenticated (or anonymous). The default isWebSessionServerOAuth2AuthorizedClientRepository.- Parameters:
anonymousAuthorizedClientRepository- the repository used for requests that are unauthenticated (or anonymous)
-
loadAuthorizedClient
public <T extends OAuth2AuthorizedClient> reactor.core.publisher.Mono<T> loadAuthorizedClient(java.lang.String clientRegistrationId, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)
Description copied from interface:ServerOAuth2AuthorizedClientRepositoryReturns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-UserAuthentication(Resource Owner) ornullif not available.- Specified by:
loadAuthorizedClientin interfaceServerOAuth2AuthorizedClientRepository- Type Parameters:
T- a type of OAuth2AuthorizedClient- Parameters:
clientRegistrationId- the identifier for the client's registrationprincipal- the End-UserAuthentication(Resource Owner)exchange- theServerWebExchange- Returns:
- the
OAuth2AuthorizedClientornullif not available
-
saveAuthorizedClient
public reactor.core.publisher.Mono<java.lang.Void> saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)
Description copied from interface:ServerOAuth2AuthorizedClientRepositorySaves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).- Specified by:
saveAuthorizedClientin interfaceServerOAuth2AuthorizedClientRepository- Parameters:
authorizedClient- the authorized clientprincipal- the End-UserAuthentication(Resource Owner)exchange- theServerWebExchange
-
removeAuthorizedClient
public reactor.core.publisher.Mono<java.lang.Void> removeAuthorizedClient(java.lang.String clientRegistrationId, org.springframework.security.core.Authentication principal, org.springframework.web.server.ServerWebExchange exchange)Description copied from interface:ServerOAuth2AuthorizedClientRepositoryRemoves theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-UserAuthentication(Resource Owner).- Specified by:
removeAuthorizedClientin interfaceServerOAuth2AuthorizedClientRepository- Parameters:
clientRegistrationId- the identifier for the client's registrationprincipal- the End-UserAuthentication(Resource Owner)exchange- theServerWebExchange
-
-