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

Add RestEasy Reactive and OidcSecurity test #25798

Merged

Conversation

sberyozkin
Copy link
Member

@sberyozkin sberyozkin commented May 25, 2022

Fixes #25722.

@geoand FYI, see TestSecurityLazyAuthTest. The RestEasy Classic based test runs here: https://github.com/quarkusio/quarkus/blob/main/integration-tests/smallrye-jwt-token-propagation/src/test/java/io/quarkus/it/keycloak/TestSecurityLazyAuthTest.java,

I've just copied that test and ProtectedJwtResource to integration-tests/oidc-token-propagation-reactive.

JwtSecurity extends TestSecurity and offers one option for supporting testing the endpoints which have an injected JsonWebtoken.
It is processed here: https://github.com/quarkusio/quarkus/blob/main/test-framework/security-jwt/src/main/java/io/quarkus/test/security/jwt/JwtTestSecurityIdentityAugmentorProducer.java

and this test augmentor is initiated from here:

https://github.com/quarkusio/quarkus/blob/main/test-framework/security/src/main/java/io/quarkus/test/security/QuarkusSecurityTestExtension.java#L88.

So this JwtTestSecurityIdentityAugmentorProducer adds a JsonWebToken instance to the current SecurityIdentity and this producer, https://github.com/quarkusio/quarkus/blob/main/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java#L40, is expected to support the injection of JsonWebToken using this emulated token.

this test gives NPE, ProtectedJwtResource throws it because JsonWebToken remains null and is not injected.

Have a look please when you can get a chance

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sberyozkin
Copy link
Member Author

@geoand Np at all, let me know please if I can help somehow, check some reactive resteasy code, etc

@geoand
Copy link
Contributor

geoand commented May 26, 2022

Will do!

@sberyozkin sberyozkin force-pushed the test_jwt_security_resteasy_reactive branch from 6886861 to 6ddf2d2 Compare June 9, 2022 12:44
@sberyozkin sberyozkin marked this pull request as ready for review June 9, 2022 12:51
@sberyozkin sberyozkin changed the title Add RestEasy Reactive and JwtSecurity test Add RestEasy Reactive and OidcSecurity test Jun 9, 2022
@sberyozkin
Copy link
Member Author

@geoand I've updated the test to use OidcSecurity instead as the OIDC JsonWebToken producer enforces JsonWebToken was indirectly created by quarkus-oidc. All works fine with RestEasy Reactive.

And, also, locally, I've modified integration-tests/smallrye-jwt-token-propagation to use RestEasy Reactive which uses JwtSecurity and it also works fine (I'm not sure it is worth adding a new integration test module just to test this case though).

So it is a Can't reproduce case

@geoand
Copy link
Contributor

geoand commented Jun 9, 2022

Understood, thanks for looking into it @sberyozkin!

@sberyozkin sberyozkin merged commit 2e7e9bb into quarkusio:main Jun 9, 2022
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 9, 2022
@sberyozkin sberyozkin deleted the test_jwt_security_resteasy_reactive branch June 9, 2022 14:28
@gsmet gsmet modified the milestones: 2.11 - main, 2.10.0.Final Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@JwtSecurity works with Resteasy Classic but stopped working with Resteasy Reactive
3 participants