Class RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
- java.lang.Object
-
- org.springframework.security.oauth2.client.RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
-
- All Implemented Interfaces:
OAuth2AuthorizationFailureHandler
public class RemoveAuthorizedClientOAuth2AuthorizationFailureHandler extends java.lang.Object implements OAuth2AuthorizationFailureHandler
AnOAuth2AuthorizationFailureHandlerthat removes anOAuth2AuthorizedClientwhen theOAuth2Error.getErrorCode()matches one of the configuredOAuth 2.0 error codes.- Since:
- 5.3
- See Also:
OAuth2AuthorizedClient,OAuth2AuthorizedClientRepository,OAuth2AuthorizedClientService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemoverRemoves anOAuth2AuthorizedClientfrom anOAuth2AuthorizedClientRepositoryorOAuth2AuthorizedClientService.
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<java.lang.String>DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODESThe default OAuth 2.0 error codes that will trigger removal of anOAuth2AuthorizedClient.
-
Constructor Summary
Constructors Constructor Description RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover)Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandlerusing the provided parameters.RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, java.util.Set<java.lang.String> removeAuthorizedClientErrorCodes)Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandlerusing the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonAuthorizationFailure(org.springframework.security.oauth2.core.OAuth2AuthorizationException authorizationException, org.springframework.security.core.Authentication principal, java.util.Map<java.lang.String,java.lang.Object> attributes)Called when an OAuth 2.0 Client fails to authorize (or re-authorize) via the Authorization Server or Resource Server.
-
-
-
Field Detail
-
DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
public static final java.util.Set<java.lang.String> DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
The default OAuth 2.0 error codes that will trigger removal of anOAuth2AuthorizedClient.- See Also:
OAuth2ErrorCodes
-
-
Constructor Detail
-
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
public RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover)
Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandlerusing the provided parameters.- Parameters:
authorizedClientRemover- theRemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemoverused for removing anOAuth2AuthorizedClientif the error code is one of theDEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES.
-
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
public RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, java.util.Set<java.lang.String> removeAuthorizedClientErrorCodes)
Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandlerusing the provided parameters.- Parameters:
authorizedClientRemover- theRemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemoverused for removing anOAuth2AuthorizedClientif the error code is one of theremoveAuthorizedClientErrorCodes.removeAuthorizedClientErrorCodes- the OAuth 2.0 error codes which will trigger removal of an authorized client.- See Also:
OAuth2ErrorCodes
-
-
Method Detail
-
onAuthorizationFailure
public void onAuthorizationFailure(org.springframework.security.oauth2.core.OAuth2AuthorizationException authorizationException, org.springframework.security.core.Authentication principal, java.util.Map<java.lang.String,java.lang.Object> attributes)Description copied from interface:OAuth2AuthorizationFailureHandlerCalled when an OAuth 2.0 Client fails to authorize (or re-authorize) via the Authorization Server or Resource Server.- Specified by:
onAuthorizationFailurein interfaceOAuth2AuthorizationFailureHandler- Parameters:
authorizationException- the exception that contains details about what failedprincipal- thePrincipalassociated with the attempted authorizationattributes- an immutableMapof (optional) attributes present under certain conditions. For example, this might contain ajavax.servlet.http.HttpServletRequestandjavax.servlet.http.HttpServletResponseif the authorization was performed within the context of ajavax.servlet.ServletContext.
-
-