public final class AuthenticatedPrincipalOAuth2AuthorizedClientRepository extends java.lang.Object implements OAuth2AuthorizedClientRepository
OAuth2AuthorizedClientRepository that delegates to the
provided OAuth2AuthorizedClientService if the current Principal is
authenticated, otherwise, to the default (or provided)
OAuth2AuthorizedClientRepository if the current request is unauthenticated (or
anonymous). The default OAuth2AuthorizedClientRepository is
HttpSessionOAuth2AuthorizedClientRepository.| Constructor and Description |
|---|
AuthenticatedPrincipalOAuth2AuthorizedClientRepository(OAuth2AuthorizedClientService authorizedClientService)
Constructs a
AuthenticatedPrincipalOAuth2AuthorizedClientRepository using
the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
<T extends OAuth2AuthorizedClient> |
loadAuthorizedClient(java.lang.String clientRegistrationId,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request)
Returns the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner) or
null if not available. |
void |
removeAuthorizedClient(java.lang.String clientRegistrationId,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Removes the
OAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner). |
void |
saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Saves the
OAuth2AuthorizedClient associating it to the provided End-User
Authentication (Resource Owner). |
void |
setAnonymousAuthorizedClientRepository(OAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)
Sets the
OAuth2AuthorizedClientRepository used for requests that are
unauthenticated (or anonymous). |
public AuthenticatedPrincipalOAuth2AuthorizedClientRepository(OAuth2AuthorizedClientService authorizedClientService)
AuthenticatedPrincipalOAuth2AuthorizedClientRepository using
the provided parameters.authorizedClientService - the authorized client servicepublic void setAnonymousAuthorizedClientRepository(OAuth2AuthorizedClientRepository anonymousAuthorizedClientRepository)
OAuth2AuthorizedClientRepository used for requests that are
unauthenticated (or anonymous). The default is
HttpSessionOAuth2AuthorizedClientRepository.anonymousAuthorizedClientRepository - the repository used for requests that
are unauthenticated (or anonymous)public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(java.lang.String clientRegistrationId, org.springframework.security.core.Authentication principal, javax.servlet.http.HttpServletRequest request)
OAuth2AuthorizedClientRepositoryOAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner) or
null if not available.loadAuthorizedClient in interface OAuth2AuthorizedClientRepositoryT - a type of OAuth2AuthorizedClientclientRegistrationId - the identifier for the client's registrationprincipal - the End-User Authentication (Resource Owner)request - the HttpServletRequestOAuth2AuthorizedClient or null if not availablepublic void saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
OAuth2AuthorizedClientRepositoryOAuth2AuthorizedClient associating it to the provided End-User
Authentication (Resource Owner).saveAuthorizedClient in interface OAuth2AuthorizedClientRepositoryauthorizedClient - the authorized clientprincipal - the End-User Authentication (Resource Owner)request - the HttpServletRequestresponse - the HttpServletResponsepublic void removeAuthorizedClient(java.lang.String clientRegistrationId,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
OAuth2AuthorizedClientRepositoryOAuth2AuthorizedClient associated to the provided client
registration identifier and End-User Authentication (Resource Owner).removeAuthorizedClient in interface OAuth2AuthorizedClientRepositoryclientRegistrationId - the identifier for the client's registrationprincipal - the End-User Authentication (Resource Owner)request - the HttpServletRequestresponse - the HttpServletResponse