-
Notifications
You must be signed in to change notification settings - Fork 15
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
Detect permission constructor parameters based on formal method names match with a method secured by the @PermissionsAllowed annotation #54
Conversation
This seems to be missing the implementation change. I'd suggest full names for the constants, so |
Autodetection based on parameter names is implemented and it is already done, what is different at the moment is that: it's only activated when you specify
Will change that, thank you. |
But yeah, it can only be merged/released/bumped to Quarkus when quarkusio/quarkus#43353 is finalized and approved, not before. Sorry I didn't mention it in the PR description, but I thought Sergey knew that. |
867d4e5
to
30dc1bb
Compare
I have a feeling we should not be really introducing these strategies but should simply enhance Quarkus directly to cover ambiguities. In many cases, just having Otherwise, in those advanced cases where passing a |
Michal, are you concerned that we have |
@michalvavrik We can discuss it in a wider forum, and I guess I can add a breaking change note to the Migration guide, we just don't need an API change to support types only IMHO, this option's robustness is very limited |
Yes, that is exactly my concern. I agree with above-mentioned arguments (your and Stephane comments).
I have checked https://quarkus.io/guides/security-authorize-web-endpoints-reference#permission-annotation and only problematic part I can see is one sentence
What we can do is to do matching based on parameter names. If there is not a one match based on name, we can fallback to matching based on the parameter types. I think we should drop behavior where it's identified based on data type if multiple strategies like proposed in this PR are not desirable. However this is why I think it is breaking change:
that previously would be |
However, that |
30dc1bb
to
e916ebe
Compare
@sberyozkin @FroMage updated API in this PR, now I'll update quarkusio/quarkus#43353 accordingly; comment if you want, or wait till the implementation is done |
e916ebe
to
e96f1dd
Compare
Thanks @michalvavrik I think it looks good, let me just have another look early next week :-) @cescoffier, FYI, here, Michal is only updating the JavaDocs advising how to ensure the JAX-RS parameter names match the custom permission constructor parameters, if you'd like, please comment |
@michalvavrik, I've just looked again, and it is really all very well explained, and indeed, like you said, |
Let's keep the PR itself open for a while till you get time to implement it in Quarkus, and in case some more comments will follow here, thanks for your help, @michalvavrik |
Could you rephrase the PR to highlight that it's a javadoc enhancement. |
Rewrote the PR title and description. If additional adjustments are needed, please let me know. |
Proposes to detect parameters of a custom
java.security.Permission
based on matching formal parameter names between Permission constructor and a method secured with the@PermissionsAllowed
annotation. For ambiguous scenarios, user can specifyparams
attribute explicitly like@PermissionsAllowed(params = "beanParam.nested")
. This allows to determine concrete secured method parameter that needs to be passed to a Permission specified viapermisson
attribute, like@PermissionsAllowed(permission = "CustomPermission")
.This is motivated by discussion in quarkusio/quarkus#43353.