quarkus: Injecting into custom ClientRequestFilter does not work with Reactive RestClient

Describe the bug

Reported by Simone DiCola.

For example, injecting a RequestScoped Tokens shipped with quarkus-oidc-client into a custom filter:

@Provider
@Priority(Priorities.AUTHENTICATION)
public class OidcClientRequestCustomFilter implements ClientRequestFilter {

    @Inject
    Tokens tokens;

    @Override
    public void filter(ClientRequestContext requestContext) throws IOException {
        requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, "Bearer " + tokens.getAccessToken());
    }
}

works with quarkus-rest-client but it is null with quarkus-rest-client-reactive.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Actually the test passes now - it is just that the reactive client is a bit sensitive to the lack of @Produces("text/plain") - probably because it assumes application/json by default… So all is good there - if you’d like please close this issue - unless you’d like to track a possible @RegisterProvider(MyProvider.class) + CDI enhancement here…

Cheers

Thanks @sberyozkin. If you come up with a reproducer of the problem, I’d love to see it 😃

@geoand, Np at all, cool, great you are already aware of where the problem is 😃