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.ExchangeFilterFunctionAnExchangeFilterFunctionthat adds the Bearer Token from an existingAbstractOAuth2Tokentied to the currentAuthentication. Suitable for Servlet applications, applying it to a typicalWebClientconfiguration:@Bean WebClient webClient() { ServletBearerExchangeFilterFunction bearer = new ServletBearerExchangeFilterFunction(); return WebClient.builder() .filter(bearer).build(); }To locate the bearer token, this looks in the ReactorContextfor a key of typeAuthentication. Registering {@see org.springframework.security.config.annotation.web.configuration.OAuth2ResourceServerConfiguration.OAuth2ResourceServerWebFluxSecurityConfiguration.BearerRequestContextSubscriberRegistrar}, as a@Beanwill take care of this automatically, but certainly an application can supply aContextof 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:
filterin interfaceorg.springframework.web.reactive.function.client.ExchangeFilterFunction
-
-