Closed
Description
Summary
The whole context can be found on Stackoverflow.
Actual Behavior
Despite configuring a WebClient to propagate the access token after OIDC logging of a Spring Boot Oauth2 Client application...
@Bean
fun webClient(): WebClient {
return WebClient.builder()
.filter(ServletBearerExchangeFilterFunction())
.build()
}
The token is not propagated since ServletBearerExchangeFilterFunction
doesn't have access to the access token from OAuth2AuthenticationToken
:
private Mono<AbstractOAuth2Token> oauth2Token() {
return Mono.subscriberContext()
.flatMap(this::currentAuthentication)
.filter(authentication -> authentication.getCredentials() instanceof AbstractOAuth2Token)
.map(Authentication::getCredentials)
.cast(AbstractOAuth2Token.class);
}
Expected Behavior
The access token is propagated by the WebClient.
Configuration
https://github.com/codependent/spring-boot-2-oidc-sample
Version
5.2.x
Sample
Metadata
Metadata
Assignees
Labels
No labels