Class DefaultOAuth2AuthorizedClientRepository

  • All Implemented Interfaces:
    org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository

    public class DefaultOAuth2AuthorizedClientRepository
    extends Object
    implements org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
    This service stores an OAuth2AuthorizedClient as a Base64 encoded value in a cookie.
    Author:
    Cade Rea (cade-rea)
    • Constructor Detail

      • DefaultOAuth2AuthorizedClientRepository

        public DefaultOAuth2AuthorizedClientRepository​(StatelessUtil statelessUtil,
                                                       ContextHelperService contextHelperService,
                                                       org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
    • Method Detail

      • loadAuthorizedClient

        @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)
        Specified by:
        loadAuthorizedClient in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
      • saveAuthorizedClient

        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)
        Specified by:
        saveAuthorizedClient in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
      • removeAuthorizedClient

        public void removeAuthorizedClient​(String clientRegistrationId,
                                           org.springframework.security.core.Authentication principal,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
        Specified by:
        removeAuthorizedClient in interface org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
      • serializeAuthorizedClient

        protected String serializeAuthorizedClient​(Object authorizedClient)
        Serialize the given OAuth2AuthorizedClient into a Base-64 encoded String.
        Parameters:
        authorizedClient -
        Returns:
      • getSavedAuthClientCookieName

        protected String getSavedAuthClientCookieName()
      • getClientRegistrationRepository

        protected org.springframework.security.oauth2.client.registration.ClientRegistrationRepository getClientRegistrationRepository()
      • getObjectMapper

        protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      • setObjectMapper

        protected void setObjectMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)