Class RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
- java.lang.Object
-
- org.springframework.security.oauth2.client.RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
-
- All Implemented Interfaces:
OAuth2AuthorizationFailureHandler
public class RemoveAuthorizedClientOAuth2AuthorizationFailureHandler extends java.lang.Object implements OAuth2AuthorizationFailureHandler
AnOAuth2AuthorizationFailureHandler
that removes anOAuth2AuthorizedClient
when 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 interface
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
Removes anOAuth2AuthorizedClient
from anOAuth2AuthorizedClientRepository
orOAuth2AuthorizedClientService
.
-
Field Summary
Fields Modifier and Type Field Description static 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
.
-
Constructor Summary
Constructors Constructor Description RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover)
Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, java.util.Set<java.lang.String> removeAuthorizedClientErrorCodes)
Constructs aRemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onAuthorizationFailure(OAuth2AuthorizationException authorizationException, 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 aRemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.- Parameters:
authorizedClientRemover
- theRemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
used for removing anOAuth2AuthorizedClient
if 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 aRemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.- Parameters:
authorizedClientRemover
- theRemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
used for removing anOAuth2AuthorizedClient
if 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(OAuth2AuthorizationException authorizationException, Authentication principal, java.util.Map<java.lang.String,java.lang.Object> attributes)
Description copied from interface:OAuth2AuthorizationFailureHandler
Called when an OAuth 2.0 Client fails to authorize (or re-authorize) via the Authorization Server or Resource Server.- Specified by:
onAuthorizationFailure
in interfaceOAuth2AuthorizationFailureHandler
- Parameters:
authorizationException
- the exception that contains details about what failedprincipal
- thePrincipal
associated with the attempted authorizationattributes
- an immutableMap
of (optional) attributes present under certain conditions. For example, this might contain ajavax.servlet.http.HttpServletRequest
andjavax.servlet.http.HttpServletResponse
if the authorization was performed within the context of ajavax.servlet.ServletContext
.
-
-