-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow @PermissionChecker
methods to authorize secured methods when @TestSecurity
annotation is applied and conditionally apply SecurityIdentityAugmentors
#44535
Conversation
This comment has been minimized.
This comment has been minimized.
@michalvavrik Just a quick check, AFAIK, the augmentors can only be applied to the test identity if the user chose to do it with a property, otherwise, given that augmentors can make remote calls, applying them alongside |
I am -1 to add yet another configuration property. I'll add it if you insist, but I think if we continue this way, "developing with Quarkus" will mean a lot of reading docs for a note why my augmentors are not applied. I prefer as little exceptions as possible.
If you don't want to use certain bean in a test environment, please use
This PR always applys augmentors. |
I think I made mistake that I haven't added example with |
@michalvavrik Sorry, I was not proposing a new property, I thought there was a property in https://quarkus.io/guides/security-testing#mixing-security-tests, but I see now it is done dynamically - if there is no
Well, until now, on the So making augmentors always available can be a breaking change for some of the I'm not 100% sure how to resolve it cleanly. The description at #44479 refers to this text I guess it is either marking this PR as a breaking change and asking users to add |
You are right, applying augmentors makes this PR breaking. My personal preference was to apply augmentors, but we can keep status quo and add a new feature: apply augmentors on demand with |
17772d2
to
e6a895b
Compare
SecurityIdentityAugmentor
instances to the SecurityIdentity produced by @TestSecurity
annotation@PermissionChecker
methods to authorize secured methods when @TestSecurity
annotation is applied and conditionally apply SecurityIdentityAugmentors
🙈 The PR is closed and the preview is expired. |
Status for workflow
|
Should be done, ready for review when the time is right for you. |
Status for workflow
|
Thanks @michalvavrik |
@PermissionAllowed("see")
where thesee
permission was granted by@PermissionChecker("see")
checker method always returned 401/403, now the checker method is actually invoked when the@TestSecurity
annotation is appliedSecurityIdentityAugmentors
did not augment the identity produced by the@TestSecurity
annotation, now users can explicitly list augmentors that should be applied