Class ServerOAuth2AuthorizedClientExchangeFilterFunction

java.lang.Object
org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction
All Implemented Interfaces:
org.springframework.web.reactive.function.client.ExchangeFilterFunction

public final class ServerOAuth2AuthorizedClientExchangeFilterFunction extends Object implements org.springframework.web.reactive.function.client.ExchangeFilterFunction
Provides an easy mechanism for using an OAuth2AuthorizedClient to make OAuth2 requests by including the token as a Bearer Token.

Authentication and Authorization Failures

Since 5.3, this filter function has the ability to forward authentication (HTTP 401 Unauthorized) and authorization (HTTP 403 Forbidden) failures from an OAuth 2.0 Resource Server to a ReactiveOAuth2AuthorizationFailureHandler. A RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler can be used to remove the cached OAuth2AuthorizedClient, so that future requests will result in a new token being retrieved from an Authorization Server, and sent to the Resource Server.

If the ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveClientRegistrationRepository, ServerOAuth2AuthorizedClientRepository) constructor is used, a RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler will be configured automatically.

If the ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientManager) constructor is used, a RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler will NOT be configured automatically. It is recommended that you configure one via setAuthorizationFailureHandler(ReactiveOAuth2AuthorizationFailureHandler).

Since:
5.1