Skip to content

Resource Server should support WebClient Bearer Token propagation #7284

Closed
@jzheaux

Description

@jzheaux

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.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions