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

QuarkusSecurityTestExtension should not call CDI.current() when annotation is not present. #36601

Closed
joggeli34 opened this issue Oct 20, 2023 · 2 comments · Fixed by #36645
Closed
Labels
area/arc Issue related to ARC (dependency injection) area/security kind/bug Something isn't working
Milestone

Comments

@joggeli34
Copy link
Contributor

joggeli34 commented Oct 20, 2023

Describe the bug

In the QuarkusSecurityTestExtension.afterEache(...) method, CDI is called without checking if @TestSecurity annotation is present.

This prevents the usage of quarkus.test.enable-callbacks-for-integration-tests=true when this extension is present, even it is not used for the @QuarkusIntegrationTest itself.

We like to use the callbacks in the integration tests for some other custom callbacks.

Expected behavior

The extension should do nothing on methods not annotated with @TestSecurity

Actual behavior

It calls CDI which leads to errors for integration tests.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.4.3

Build tool (ie. output of mvnw --version or gradlew --version)

gradle 8.4.0

Additional information

No response

@joggeli34 joggeli34 added the kind/bug Something isn't working label Oct 20, 2023
@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/security labels Oct 20, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 20, 2023

/cc @Ladicek (arc), @manovotn (arc), @mkouba (arc), @sberyozkin (security)

@Ladicek
Copy link
Contributor

Ladicek commented Oct 23, 2023

The beforeEach() method already does that check, so this should be just a matter of factoring that code out and calling it from both beforeEach() and afterEach().

@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Oct 23, 2023
@gsmet gsmet modified the milestones: 3.6 - main, 3.5.1 Oct 26, 2023
@aloubyansky aloubyansky modified the milestones: 3.5.1, 3.2.8.Final Nov 2, 2023
mocenas added a commit to mocenas/quarkus-test-suite that referenced this issue Nov 10, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
michalvavrik pushed a commit to michalvavrik/quarkus-test-suite that referenced this issue Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) area/security kind/bug Something isn't working
Projects
None yet
4 participants