-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix API key cookie authentication (#568) #569
Conversation
🎊 PR Preview b47f3c2 has been successfully built and deployed. See the documentation preview: https://quarkus-openapi-generator-preview-pr-569.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were you able to test in your environment with your example OpenAPI file? Can you use your file to write an IT for this use case?
I can only work on this on fridays, but yes, my locally published snapshot fixes the issue. I will look into the ITs to see if I can create/adapt one. Edit: I can't get the ITs to run locally on my machine, neither using the classic nor the reactive profile. That makes developing an IT a little bit hard. Any hints?
|
Can you investigate this generated file?
|
...e/src/main/java/io/quarkiverse/openapi/generator/providers/ApiKeyAuthenticationProvider.java
Outdated
Show resolved
Hide resolved
I have checked the generated file and everything looks fine. Therefore, I decided to have a look at the dependency injection. While reading the Quarkus DI guide I discovered the option to prevent ArC from removing configured beans. After adding the following line to my local application config, I was able to run the tests:
I have no idea why the rest client is removed per default on my local test setup, as it works fine whtin the GitHub pipeline. However, with this little hack I could verify my test works out by having a failure without the fix and a success with the fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ssternal you need to add the cookie-authentication
module to its parent module so the tests can run.
The automated build failed due to an error with the new integration test. The issue arises due to availability of two REST implementations (classic v/s reactive). This again is because of the default activated classic maven profile. During the development of the integration test I asked myself if the classic profile should be acivated per default. Since the integration tests are designed to explicitly activate it when invoking the classic integraion tests I would recommend disabling the default behavior. |
@ssternal we need to run tests with RESTEasy Classic and Reactive, unless in rare situations. PTAL at https://github.com/quarkiverse/quarkus-openapi-generator/blob/main/CONTRIBUTING.md#resteasy-reactive-and-resteasy-classic. To fix the failing tests you need to remove the dependencies from the test pom.xml. Those dependencies are handled by the parent module. You can use https://github.com/quarkiverse/quarkus-openapi-generator/blob/main/integration-tests/simple/pom.xml as an example. |
Co-authored-by: nmirasch <neus.miras@gmail.com>
...tication/src/test/java/io/quarkiverse/openapi/generator/it/WiremockCookieAuthentication.java
Fixed
Show fixed
Hide fixed
...tication/src/test/java/io/quarkiverse/openapi/generator/it/WiremockCookieAuthentication.java
Outdated
Show resolved
Hide resolved
Co-authored-by: nmirasch <neus.miras@gmail.com>
...tication/src/test/java/io/quarkiverse/openapi/generator/it/WiremockCookieAuthentication.java
Dismissed
Show dismissed
Hide dismissed
@all-contributors add @nmirasch for code. |
I've put up a pull request to add @nmirasch! 🎉 |
Fixes #568:
Replaces access to read-only cookies using mutable headers during API key cookie authentication. This works around a potential
UnsupportedOperationException
.