Class SynchronizedDelegatingOAuth2AuthorizedClientManager

java.lang.Object
com.broadleafcommerce.inventory.service.provider.oauth2.SynchronizedDelegatingOAuth2AuthorizedClientManager
All Implemented Interfaces:
org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager

public class SynchronizedDelegatingOAuth2AuthorizedClientManager extends Object implements org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
This component implements OAuth2AuthorizedClientManager and internally instantiates and delegates to AuthorizedClientServiceOAuth2AuthorizedClientManager. The only difference between this and AuthorizedClientServiceOAuth2AuthorizedClientManager is that this attempts to serialize on the OAuth2AuthorizeRequest.getClientRegistrationId(). The reason is that these clients are normally shared clients, with shared access tokens. As a result, only one thread needs to call the auth server when the token is unavailable or otherwise expired. The token is then stored in InMemoryOAuth2AuthorizedClientService for re-use across threads. This helps prevent a race condition where multiple threads are trying to fetch the same token at the same time via a network call.
Author:
Kelly Tisdell (ktisdell)
  • Constructor Details

    • SynchronizedDelegatingOAuth2AuthorizedClientManager

      public SynchronizedDelegatingOAuth2AuthorizedClientManager(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
  • Method Details

    • authorize

      public org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorize(org.springframework.security.oauth2.client.OAuth2AuthorizeRequest authorizeRequest)
      Specified by:
      authorize in interface org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
    • setAuthorizedClientProvider

      public void setAuthorizedClientProvider(org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider authorizedClientProvider)
      See Also:
      • AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizedClientProvider(OAuth2AuthorizedClientProvider)
    • setContextAttributesMapper

      public void setContextAttributesMapper(Function<org.springframework.security.oauth2.client.OAuth2AuthorizeRequest,Map<String,Object>> contextAttributesMapper)
      See Also:
      • AuthorizedClientServiceOAuth2AuthorizedClientManager.setContextAttributesMapper(Function)
    • setAuthorizationSuccessHandler

      public void setAuthorizationSuccessHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationSuccessHandler authorizationSuccessHandler)
      See Also:
      • AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizationSuccessHandler(OAuth2AuthorizationSuccessHandler)
    • setAuthorizationFailureHandler

      public void setAuthorizationFailureHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationFailureHandler authorizationFailureHandler)
      See Also:
      • AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizationFailureHandler(OAuth2AuthorizationFailureHandler)