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
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionThe default OAuth 2.0 error codes that will trigger removal of the authorized client. -
Constructor Summary
ConstructorsConstructorDescriptionRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandlerusing the provided parameters.RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, Set<String> removeAuthorizedClientErrorCodes) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandlerusing 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 aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandlerusing the provided parameters.- Parameters:
authorizedClientRemover- theRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemoverused for removing anOAuth2AuthorizedClientif the error code is one of theDEFAULT_REMOVE_AUTHORIZED_CLIENT_ERROR_CODES.
-
RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler
public RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler(RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.OAuth2AuthorizedClientRemover authorizedClientRemover, Set<String> removeAuthorizedClientErrorCodes) Constructs aRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandlerusing the provided parameters.- Parameters:
authorizedClientRemover- theRemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.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:
-
-
Method Details
-
onAuthorizationFailure
public reactor.core.publisher.Mono<Void> onAuthorizationFailure(OAuth2AuthorizationException authorizationException, Authentication principal, Map<String, Object> attributes) Description copied from interface:ReactiveOAuth2AuthorizationFailureHandlerCalled when an OAuth 2.0 Client fails to authorize (or re-authorize) via the authorization server or resource server.- Specified by:
onAuthorizationFailurein interfaceReactiveOAuth2AuthorizationFailureHandler- Parameters:
authorizationException- the exception that contains details about what failedprincipal- thePrincipalthat was attempted to be authorizedattributes- an immutableMapof extra optional attributes present under certain conditions. For example, this might contain aServerWebExchangeif the authorization was performed within the context of aServerWebExchange.- Returns:
- an empty
Monothat completes after this handler has finished handling the event.
-