Expected Behavior

Being able to provide JwtAuthenticationToken only when required.

Current Behavior

In the actual requirement, it is required to push a JwtAuthenticationToken in every call. It is very costly to get such a token. More than just making the call itself.

Authentication authentication = new JwtAuthenticationToken(jws);
String body = webClient
    .get()
    .attributes(authentication(authentication).andThen(clientRegistrationId("client-jwt-bearer")))
    .retrieve()
    .bodyToMono(String.class)
    .block();

Context

we got poor performance when making call to very fast server api requiring a JwtBearer.

As a workaround, we redevelop the JwtBearer client provider to be able to ask for a Jwt token only when required.

Comment From: jgrandja

@sclorng I re-opened gh-9812 so I'll close this as a duplicate.