Closed
Description
A resource server can propagate the bearer token by fashioning an ExchangeFilterFunction
:
ExchangeFilterFunction oauth2 = (request, next) -> {
AbstractOAuth2TokenAuthenticationToken<?> authentication =
(AbstractOAuth2TokenAuthenticationToken<?>)
SecurityContextHolder.getContext().getAuthentication();
request.headers().setBearerAuth(authentication.getToken().getTokenValue());
return next.exchange(request);
};
It would be nice to remove some of this boilerplate.