Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Resquest not properly resetted when doing retries (multiple Authorization headers provided) #900

Open
lcausse opened this issue Dec 6, 2024 · 4 comments
Labels
area:client This item is related to the client extension bug Something isn't working

Comments

@lcausse
Copy link

lcausse commented Dec 6, 2024

Using quarkus-openapi-generator (open-api JSON file) and with "Bearer Token" security context ...

When executing retries (eg waiting for a "not ready" content), the AUTHORIZATION header value is provided several times by the generated REST client (one more for each retry)

Uni<String> res = clientRestService.getSomeData().onItem().transform( response->{
        switch( response.getJobStatus() ) {
            case COMPLETED:
                return "ok";
            default:
                throw new NotReadyException();
        }
    })
    .onFailure( NotReadyException.class ).retry().withBackOff(Duration.ofSeconds(3), Duration.ofSeconds(3)).atMost(5);

Comments
clientRestService is the client API generated by quarkus-openapi-generator
clientRestService is decorated with @RegisterProvider(com.xxx.api.auth.CompositeAuthenticationProvider.class) which is responsible for adding AUTHORIZATION Header

For the 1st time the AUTHORIZATION header is provided with 1 value : "token-string" => correct
At the 5th time the AUTHORIZATION header is provided with 5x values "token-string ... token-string"=> too much !

I don't know what should be done
Option 1 - the AUTHORIZATION headers should be cleaned before "adding" => my workoaround at this time (I add a filter that set the AUTH header with an empty list )
Option 2 - the Auth provider should prevent for duplicate values

@lcausse
Copy link
Author

lcausse commented Dec 6, 2024

I also post the issue on quarkusio project #44917 and repost here following Sergey Beryozkin suggestion

@ricardozanini
Copy link
Member

@lcausse can you please provide a reproducer? It might be a bug, and I think Option 2 is doable to fix this.

@ricardozanini ricardozanini added bug Something isn't working area:client This item is related to the client extension labels Dec 6, 2024
@lcausse
Copy link
Author

lcausse commented Dec 11, 2024

I tried to create the reproducer.
https://github.com/lcausse/quarkus-openapi-generator-issue9000
This is the first time, I do this kind of job ...
I hope this is not too bad

@ricardozanini
Copy link
Member

Thank you @lcausse!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:client This item is related to the client extension bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants