Class RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
java.lang.Object
org.springframework.security.oauth2.client.RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
- All Implemented Interfaces:
ReactiveOAuth2AuthorizationFailureHandler
public class RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
extends Object
implements ReactiveOAuth2AuthorizationFailureHandler
A
ReactiveOAuth2AuthorizationFailureHandler
that removes an
OAuth2AuthorizedClient
when the OAuth2Error.getErrorCode()
matches one
of the configured OAuth 2.0 error codes
.- Since:
- 5.3
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
-
Field Summary
Modifier and TypeFieldDescriptionThe default OAuth 2.0 error codes that will trigger removal of the authorized client. -
Constructor Summary
ConstructorDescriptionRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
using the provided parameters.RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, Set<String> removeAuthorizedClientErrorCodes) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
onAuthorizationFailure
(OAuth2AuthorizationException authorizationException, Authentication principal, Map<String, Object> attributes) Called when an OAuth 2.0 Client fails to authorize (or re-authorize) via the authorization server or resource server.
-
Field Details
-
DEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
The default OAuth 2.0 error codes that will trigger removal of the authorized client.- See Also:
-
-
Constructor Details
-
RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
public RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
using the provided parameters.- Parameters:
authorizedClientRemover
- theRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover
used for removing anOAuth2AuthorizedClient
if the error code is one of theDEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES
.
-
RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
public RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, Set<String> removeAuthorizedClientErrorCodes) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
using the provided parameters.- Parameters:
authorizedClientRemover
- theRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.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:
-
-
Method Details
-
onAuthorizationFailure
public reactor.core.publisher.Mono<Void> onAuthorizationFailure(OAuth2AuthorizationException authorizationException, Authentication principal, Map<String, Object> attributes) Description copied from interface:ReactiveOAuth2AuthorizationFailureHandler
Called when an OAuth 2.0 Client fails to authorize (or re-authorize) via the authorization server or resource server.- Specified by:
onAuthorizationFailure
in interfaceReactiveOAuth2AuthorizationFailureHandler
- Parameters:
authorizationException
- the exception that contains details about what failedprincipal
- thePrincipal
that was attempted to be authorizedattributes
- an immutableMap
of extra optional attributes present under certain conditions. For example, this might contain aServerWebExchange
if the authorization was performed within the context of aServerWebExchange
.- Returns:
- an empty
Mono
that completes after this handler has finished handling the event.
-