public class RemoveAuthorizedClientOAuth2AuthorizationFailureHandler extends java.lang.Object implements OAuth2AuthorizationFailureHandler
OAuth2AuthorizationFailureHandler
that removes an OAuth2AuthorizedClient
when the OAuth2Error.getErrorCode()
matches
one of the configured OAuth 2.0 error codes
.OAuth2AuthorizedClient
,
OAuth2AuthorizedClientRepository
,
OAuth2AuthorizedClientService
Modifier and Type | Class and Description |
---|---|
static interface |
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
Removes an
OAuth2AuthorizedClient from an
OAuth2AuthorizedClientRepository or OAuth2AuthorizedClientService . |
Modifier and Type | Field and 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 an
OAuth2AuthorizedClient . |
Constructor and Description |
---|
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover)
Constructs a
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler using the provided parameters. |
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover,
java.util.Set<java.lang.String> removeAuthorizedClientErrorCodes)
Constructs a
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler using the provided parameters. |
Modifier and Type | Method and 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.
|
public static final java.util.Set<java.lang.String> DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
OAuth2AuthorizedClient
.OAuth2ErrorCodes
public RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover)
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.authorizedClientRemover
- the RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
used for removing an OAuth2AuthorizedClient
if the error code is one of the DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
.public RemoveAuthorizedClientOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, java.util.Set<java.lang.String> removeAuthorizedClientErrorCodes)
RemoveAuthorizedClientOAuth2AuthorizationFailureHandler
using the provided parameters.authorizedClientRemover
- the RemoveAuthorizedClientOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
used for removing an OAuth2AuthorizedClient
if the error code is one of the removeAuthorizedClientErrorCodes
.removeAuthorizedClientErrorCodes
- the OAuth 2.0 error codes which will trigger removal of an authorized client.OAuth2ErrorCodes
public void onAuthorizationFailure(OAuth2AuthorizationException authorizationException, Authentication principal, java.util.Map<java.lang.String,java.lang.Object> attributes)
OAuth2AuthorizationFailureHandler
onAuthorizationFailure
in interface OAuth2AuthorizationFailureHandler
authorizationException
- the exception that contains details about what failedprincipal
- the Principal
associated with the attempted authorizationattributes
- an immutable Map
of (optional) attributes present under certain conditions.
For example, this might contain a javax.servlet.http.HttpServletRequest
and javax.servlet.http.HttpServletResponse
if the authorization was performed
within the context of a javax.servlet.ServletContext
.