Class ServletBearerExchangeFilterFunction
- java.lang.Object
-
- org.springframework.security.oauth2.server.resource.web.reactive.function.client.ServletBearerExchangeFilterFunction
-
- All Implemented Interfaces:
org.springframework.web.reactive.function.client.ExchangeFilterFunction
public final class ServletBearerExchangeFilterFunction extends java.lang.Object implements org.springframework.web.reactive.function.client.ExchangeFilterFunction
AnExchangeFilterFunction
that adds the Bearer Token from an existingAbstractOAuth2Token
tied to the currentAuthentication
. Suitable for Servlet applications, applying it to a typicalWebClient
configuration:@Bean WebClient webClient() { ServletBearerExchangeFilterFunction bearer = new ServletBearerExchangeFilterFunction(); return WebClient.builder() .filter(bearer).build(); }
To locate the bearer token, this looks in the ReactorContext
for a key of typeAuthentication
. Registering {@see org.springframework.security.config.annotation.web.configuration.OAuth2ResourceServerConfiguration.OAuth2ResourceServerWebFluxSecurityConfiguration.BearerRequestContextSubscriberRegistrar}, as a@Bean
will take care of this automatically, but certainly an application can supply aContext
of its own to override.- Since:
- 5.2
-
-
Constructor Summary
Constructors Constructor Description ServletBearerExchangeFilterFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<org.springframework.web.reactive.function.client.ClientResponse>
filter(org.springframework.web.reactive.function.client.ClientRequest request, org.springframework.web.reactive.function.client.ExchangeFunction next)
-
-
-
Method Detail
-
filter
public reactor.core.publisher.Mono<org.springframework.web.reactive.function.client.ClientResponse> filter(org.springframework.web.reactive.function.client.ClientRequest request, org.springframework.web.reactive.function.client.ExchangeFunction next)
- Specified by:
filter
in interfaceorg.springframework.web.reactive.function.client.ExchangeFilterFunction
-
-