public class SynchronizedDelegatingOAuth2AuthorizedClientManager extends Object implements org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
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.Constructor and Description |
---|
SynchronizedDelegatingOAuth2AuthorizedClientManager(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository) |
Modifier and Type | Method and 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) |
public SynchronizedDelegatingOAuth2AuthorizedClientManager(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepository)
public org.springframework.security.oauth2.client.OAuth2AuthorizedClient authorize(org.springframework.security.oauth2.client.OAuth2AuthorizeRequest authorizeRequest)
authorize
in interface org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
public void setAuthorizedClientProvider(org.springframework.security.oauth2.client.OAuth2AuthorizedClientProvider authorizedClientProvider)
AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizedClientProvider(OAuth2AuthorizedClientProvider)
public void setContextAttributesMapper(Function<org.springframework.security.oauth2.client.OAuth2AuthorizeRequest,Map<String,Object>> contextAttributesMapper)
AuthorizedClientServiceOAuth2AuthorizedClientManager.setContextAttributesMapper(Function)
public void setAuthorizationSuccessHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationSuccessHandler authorizationSuccessHandler)
AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizationSuccessHandler(OAuth2AuthorizationSuccessHandler)
public void setAuthorizationFailureHandler(org.springframework.security.oauth2.client.OAuth2AuthorizationFailureHandler authorizationFailureHandler)
AuthorizedClientServiceOAuth2AuthorizedClientManager.setAuthorizationFailureHandler(OAuth2AuthorizationFailureHandler)
Copyright © 2021. All rights reserved.