-
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
Add permission checker shortcuts to QuarkusSecurityIdentity.Builder #44344
Conversation
...ions/security/runtime/src/main/java/io/quarkus/security/runtime/QuarkusSecurityIdentity.java
Outdated
Show resolved
Hide resolved
...ions/security/runtime/src/main/java/io/quarkus/security/runtime/QuarkusSecurityIdentity.java
Outdated
Show resolved
Hide resolved
🙈 The PR is closed and the preview is expired. |
This comment has been minimized.
This comment has been minimized.
107319d
to
8bc7f61
Compare
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.
LGTM, thank you, I think this will improve user experience
...ions/security/runtime/src/main/java/io/quarkus/security/runtime/QuarkusSecurityIdentity.java
Outdated
Show resolved
Hide resolved
8bc7f61
to
0e527e0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
I added a very small suggestion.
...ions/security/runtime/src/main/java/io/quarkus/security/runtime/QuarkusSecurityIdentity.java
Outdated
Show resolved
Hide resolved
0e527e0
to
a336892
Compare
Thanks @gsmet @michalvavrik, I've tweaked docs, shortcut method signatures. I've also added unit tests and while working on them I remembered that a conversion like So I've fixed that and it let me remove all the String to Permission conversion code from the OIDC too... Should be better now... |
No, I didn't expect that |
@michalvavrik We already have a convention enforced at the What do you think ? |
This comment has been minimized.
This comment has been minimized.
Sure, let's don't do it, I don't mind at all. I just say - I liked it :-). Let's not continue on discussing that, it's ok.
TBH I am lost, I think that last commit won't do. Let me come back to it tonight, I am just preparing on something. I'll come back to it and try to understand changes properly. Maybe I missed something. Thanks |
@michalvavrik Sure there is no rush... We add these shortcuts to make it easy for users to have constraints like Have a look at the OIDC test resource. Users see Now try to comment out I wonder if I should just drop the comment that a String like The JavaDoc suggestion that they can avoid the I'll drop the related comment and let you verify things later... |
a336892
to
94f7050
Compare
Dropped the comments related to how the String to Permission conversion works and that should avoid the confusion |
However, @michalvavrik, I think Take you time please to check things, no rush at all, thanks |
I'll comment & review later (maybe tomorrow), just quick note:
See https://github.com/quarkusio/quarkus-security/blob/main/src/main/java/io/quarkus/security/PermissionsAllowed.java#L87 and https://github.com/quarkusio/quarkus-security/blob/main/src/main/java/io/quarkus/security/PermissionsAllowed.java#L94. Don't get any better than that :-) I can put it to the |
Status for workflow
|
Status for workflow
|
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.
Not sure if you changed it again, but it looks good now :-D
@michalvavrik I dropped comments related to informing users that we transform it internally :-). If that looks good to you now then if we can get one more approval, from Steph or Guillaume, it will be good to go |
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.
Looks much better this way :)
Thanks @FroMage @michalvavrik @gsmet |
Fixes #43717.
This PR adds a few
QuarkusSecurityIdentity.Builder
permission checker shortcuts for users be able to avoid having to write permission checker functions.You can see the impact on the changed OIDC code which converts scopes to permissions. This code is tested in the oidc-tenancy tests (see #36361).
IMHO we should not be talking about permission checkers in the Permission docs to avoid the confusion, and to try to give a message it is all very simple. We can add some notes later if some users find that simply adding permissions to the identity builder is not enough for them