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 implementsOAuth2AuthorizedClientManager
and internally instantiates and delegates toAuthorizedClientServiceOAuth2AuthorizedClientManager
. The only difference between this andAuthorizedClientServiceOAuth2AuthorizedClientManager
is that this attempts to serialize on theOAuth2AuthorizeRequest.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 inInMemoryOAuth2AuthorizedClientService
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 Summary
Constructors Constructor Description SynchronizedDelegatingOAuth2AuthorizedClientManager(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.oauth2.client.OAuth2AuthorizedClient
authorize(org.springframework.security.oauth2.client.OAuth2AuthorizeRequest authorizeRequest)
void
setAuthorizationFailureHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationFailureHandler authorizationFailureHandler)
void
setAuthorizationSuccessHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationSuccessHandler authorizationSuccessHandler)
void
setAuthorizedClientProvider(org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider authorizedClientProvider)
void
setContextAttributesMapper(Function<org.springframework.security.oauth2.client.OAuth2AuthorizeRequest,Map<String,Object>> contextAttributesMapper)
-
-
-
Method Detail
-
authorize
public org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorize(org.springframework.security.oauth2.client.OAuth2AuthorizeRequest authorizeRequest)
- Specified by:
authorize
in interfaceorg.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)
-
-