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

CompositeAuthenticationProvider does not apply always authentication resulting to HTTP 401 responses #854

Open
siavelis opened this issue Nov 14, 2024 · 3 comments
Labels
area:client This item is related to the client extension bug Something isn't working

Comments

@siavelis
Copy link

Hello!

There is an issue in the authentication logic, as it is not always applied.

How to reproduce:

  • generate a client with operations that need any kind of authentication
  • configure the generated Quarkus client with a url prefix, example below:
quarkus.rest-client.external_api_json.url=https://external.api.com/base-url
# enable request/response body logging for debugging
quarkus.rest-client.logging.scope=request-response
quarkus.rest-client.logging.body-limit=1024
quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG
  • call an operation that needs authentication

Result:

  • authentication is not applied
  • HTTP 401 is received

Possible workaround/fixes:

  • CompositeAuthenticationProvider:canFilter uses the url path from the Openapi specification to decide whether to apply authentication or not. Hence the suggestion would be to include a case when the rest client has a prefix in the base url path
  • Remove the prefix in the base url (not possible in my case)
  • Note that using quarkus.openapi-generator.codegen.default-security-scheme will not rectify the issue

Versions used:

  • quarkus-openapi-generator: 2.6.0
  • Quarkus: 3.16.1
  • Java: 17
  • Maven: 3.9.3
@ricardozanini
Copy link
Member

@siavelis, we recently changed the way we generate the authentication code. Was it working before version 2.5.0?

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

@ricardozanini thank you for the follow up! I have tried with versions: 2.4.7 and 2.4.2 but there is the same issue

@ricardozanini
Copy link
Member

I'll take a look once I have the time. If you can, please, send a PR to fix it.

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