public class DefaultOAuth2AuthorizedClientRepository extends Object implements org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
OAuth2AuthorizedClient
as a Base64 encoded value in a cookie.Modifier and Type | Class and Description |
---|---|
static class |
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper
This class holds the necessary fields for saving and loading
OAuth2AuthorizedClient . |
Modifier and Type | Field and Description |
---|---|
static String |
COOKIE_NAME |
static long |
EXPIRES_IN_SECONDS |
Constructor and Description |
---|
DefaultOAuth2AuthorizedClientRepository(StatelessUtil statelessUtil,
ContextHelperService contextHelperService,
org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.security.oauth2.client.OAuth2AuthorizedClient |
createAuthorizedClient(String clientRegistrationId,
org.springframework.security.core.Authentication principal,
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper authorizedClientWrapper)
Create an
OAuth2AuthorizedClient from an
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper |
protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository |
getClientRegistrationRepository() |
protected ContextHelperService |
getContextHelperService() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected OAuth2AuthorizedClientRepositoryProperties |
getProperties() |
protected String |
getSavedAuthClientCookieName() |
protected StatelessUtil |
getStatelessUtil() |
<T extends org.springframework.security.oauth2.client.OAuth2AuthorizedClient> |
loadAuthorizedClient(String clientRegistrationId,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request) |
protected DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper |
readAuthClientWrapperFromCookie(javax.servlet.http.HttpServletRequest request)
Read a
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper from the authorized client cookie. |
void |
removeAuthorizedClient(String clientRegistrationId,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
saveAuthorizedClient(org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorizedClient,
org.springframework.security.core.Authentication principal,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected String |
serializeAuthorizedClient(Object authorizedClient)
Serialize the given
OAuth2AuthorizedClient into a Base-64 encoded String. |
protected void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
void |
setProperties(OAuth2AuthorizedClientRepositoryProperties properties) |
protected DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper |
wrapAuthorizedClient(org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorizedClient)
Create a new
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper from the given
OAuth2AuthorizedClient . |
public static final String COOKIE_NAME
public static final long EXPIRES_IN_SECONDS
public DefaultOAuth2AuthorizedClientRepository(StatelessUtil statelessUtil, ContextHelperService contextHelperService, org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
@Nullable public <T extends org.springframework.security.oauth2.client.OAuth2AuthorizedClient> T loadAuthorizedClient(String clientRegistrationId, org.springframework.security.core.Authentication principal, javax.servlet.http.HttpServletRequest request)
loadAuthorizedClient
in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
public void saveAuthorizedClient(org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
saveAuthorizedClient
in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
public void removeAuthorizedClient(String clientRegistrationId, org.springframework.security.core.Authentication principal, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
removeAuthorizedClient
in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
@Nullable protected DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper readAuthClientWrapperFromCookie(javax.servlet.http.HttpServletRequest request)
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper
from the authorized client cookie.request
- protected org.springframework.security.oauth2.client.OAuth2AuthorizedClient createAuthorizedClient(String clientRegistrationId, org.springframework.security.core.Authentication principal, DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper authorizedClientWrapper)
OAuth2AuthorizedClient
from an
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper
clientRegistrationId
- principal
- authorizedClientWrapper
- protected DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper wrapAuthorizedClient(org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorizedClient)
DefaultOAuth2AuthorizedClientRepository.TenantAwareOAuth2AuthorizedClientWrapper
from the given
OAuth2AuthorizedClient
.authorizedClient
- protected String serializeAuthorizedClient(Object authorizedClient)
OAuth2AuthorizedClient
into a Base-64 encoded String.authorizedClient
- protected String getSavedAuthClientCookieName()
protected StatelessUtil getStatelessUtil()
protected ContextHelperService getContextHelperService()
protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository getClientRegistrationRepository()
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
protected void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected OAuth2AuthorizedClientRepositoryProperties getProperties()
@Autowired public void setProperties(OAuth2AuthorizedClientRepositoryProperties properties)
Copyright © 2021. All rights reserved.