-
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
Avoid requiring custom permission checkers for @PermissionAllowed
to work.
#43717
Comments
/cc @pedroigor (bearer-token) |
I agree with everything this issue mentions except with this point:
I don't understand why should we add to API method that users are not supposed to use. Right now we have: which we cannot remove (both because it would be super breaking and I think it's great to have these checkers). Permissions added with the That is, we cannot say that |
due to concerns I have raised in previous comment, I'll implement it differently. I am going to have a look. |
@sberyozkin now Quarkus OIDC extension has:
would it make sense to introduce:
? |
@michalvavrik We may have some misunderstanding here
They won't, Quarkus Security will use them... I'm not sure sure what do you mean. Are users supposed to use I'm also not sure what your last comment about OIDC is about, sorry... |
You link to |
This is exactly what we should've avoided doing, it is just only now that it is becoming obvious to me...It is too complex, there should be no dev experience difference in the way roles and permissions are checked. |
@sberyozkin I agree with all of that. I just don't want to add
Ok, let's that one be. I just thought that users can map roles from token claims, we could provide same feature for permissions. but that is not for this issue and let's not discuss it here. |
Why exactly :-) ? Why are we differentiating between roles and permissions as far as their association with the identity is concerned ? How do I know as a user what permission the current identity has ? |
So how will it look if the users can't do what is proposed in quarkusio/quarkus-security#57,
? |
Because I am worried that it will be confusing and we gain nothing, users don't need to get permissions. I am worried about this method: If you add permission getter, it means that anyone can get these permissions. So how will you explain that Or do you want to remove it? I realize you wrote that we will run "permission checkers" and then "permissions" when |
You could achieve same by adding same |
I reviewed quarkusio/quarkus-security#57, let's go with your plan and continue discussion there. It doesn't need to be my way. Thanks for this effort. |
Michal, we don't have to forget your plan, but discuss pros and cons of both plans and find a compromise, I appreciate your concerns. In fact I'm thinking our plans are not that far away :-)
Aha, we are actually not thinking that differently, see the code above :-) So, quarkusio/quarkus-security#57 does not have to be a prerequisite...
It does not conflict with Would you like to start with what you suggested and we can consider quarkusio/quarkus-security#57 later ? |
My problem in general with the SecurityIdentity API that we offer a simple get / boolean check access to roles (which can be seen as a high level grouping of permissions) while require users write manual checking code to manage permissions, and there is no any association between the identity and the possessed permissions - only an indirect association at the checker level, but in any case, I'm OK with starting from only |
@michalvavrik I can do it myself to save you some time if you'd like and ask you to review ? Oh please complete it if you have already started looking into it, thanks for your help |
Alright, if that is documented in quarkusio/quarkus-security#57 I think we can go with it. I just think we should clarify their relation because if we didn't start from here, from the existing state, I'd tell you that
Yeah, let's go for it, I will be busy till Friday and then I have loads other Quarkus issues planned. Thanks, I think |
@michalvavrik
Sure, let me look into it and I'll ask you to review... IMHO users will be happy they won't have to register checkers :-) |
@sberyozkin by now I think I understand and I am fine with the plan. Thanks for pushing this forward.
IMO that is not necessary. But it can take long enough to get reviews and Quarkus Security API release, so let's start with the |
Description
Right now, for
@PermissionAllowed
to work, users must add custom permission checkerFunctions
in the custom security identity augmentor. For example:And, now, users should add permission checkers, this code from
OidcIdentityProvider
which convertsscope
claim to permissions shows it well:I recall, Stuart, myself, Michal, all looked at it and it looked totally fine, but after the recent discussions it just struck me, why do we require users do it ?
Let's compare it with RBAC:
and this is all the users have to do in case of OIDC token containing this role. Or they can add it:
Quarkus security does the rest: it matches roles itself.
IMHO, exactly the same should happen for permissions.
Implementation ideas
SecurityIdentity
should return an unmodifiable set of possessedPermission
s,Set<Permission> getPermissions()
.QuarkusSecurityIdentity.Builder should have
addPermission(String)
,addPermission(Permission)
: these are the only methods users may have to call to associate a permission with the identityIf existing SecurityIdentity permission checkers do not allow a given required permission, QuarkusSecurity iterates over
identity.getPermissions()
and checks which oneimplies
required permission.The text was updated successfully, but these errors were encountered: