[KEYCLOAK-7367] - User-Managed Policy Provider#5211
[KEYCLOAK-7367] - User-Managed Policy Provider#5211pedroigor merged 1 commit intokeycloak:masterfrom
Conversation
chicco785
left a comment
There was a problem hiding this comment.
not much to say on my side, just a small doubt on management of denied permissions in case of uma policies.
There was a problem hiding this comment.
@pedroigor stupid question, should i use the same header in my code?
i copied an old one that refers to Jboss.
There was a problem hiding this comment.
what if the user deleted the policy directly?
There was a problem hiding this comment.
The policy lifetime is closely related with the tickets granted by the user. It will be removed, eventually, when the last granted ticket is removed.
Does that answer your question ?
There was a problem hiding this comment.
I was thinking to the other case, suppose the owner of a resource authorise the ticket, and then instead of removing the ticket, he remove the policy. Probably we should remove the ticket (if it is not attached to other policies). Just a small glitch that may happen.
There was a problem hiding this comment.
Policies should never be removed directly. It is a managed thing that only Keycloak knows how to do it properly. Today, whenever you grant, revoke or remove a ticket, policies are updated/removed accordingly.
There was a problem hiding this comment.
shouldn't be collected also the denied user managed policies?
There was a problem hiding this comment.
Denied permissions are already collected and considered when calculating the scopes the user is allowed to access. However, user-managed policies that evaluated to a PERMIT override the final decision. For instance, suppose scopes A, B and C were denied for Resource Z. If there is a user managed policy that grants access to scopes A and C, these two scopes will be granted at the end although they were denied by other policies.
|
@pedroigor the AuthorizationTokenService needs to be updated right? i am asking because i still can't evaluate as a normal permission an uma granted one. i made the following test:
|
|
@chicco785, I may be missing this scenario. Will check it out. I think user managed policies are not being considered when obtaining all entitlements for a user. |
|
but this is what the uma-policy api allows now: manage uma policies.
so we should filter out "uma" policies that are connected to a ticket.
|
|
@chicco785, it should be fixed now. You should be able to obtain permissions for resources granted via UMA when evaluating all permissions. |
|
@pedroigor i think there may be still some issues in the evaluation:
even worst...
this occurs after I created a UMA user policy via the ticket permission. If i remove that policy, everything gets back to normal. |
|
@chicco785 , how did you create the ticket ? |
if it helps, here is the current configuration of my client: |
|
@chicco785, I was able to reproduce the issue. Thanks for all the details. It should be fixed now and I have added tests that make sure this won't happen again. The issue was related to how permissions associated with resources set with a type were being evaluated. |
|
@pedroigor happy to be helpful :) as soon as i have some time, I am going to check again. At the latest tomorrow morning. |
|
@pedroigor i think there are stills issues. issue 1:
issue 2:
issue 3:
|
|
The behaviour for I think the issue you are facing with |
|
i introspected the token it contains the groups (but maybe this is not what you mean by "claim"): Regardless the claim, if that was the problem, in issue 2 and issue 3, shouldn't be the behaviour the same? Also, i tested with a
|
|
I'll need to test those issues using your changes. So far I was basically checking my changes to #5211. |
|
@chicco785, I was checking |
|
@pedroigor maybe I am doing something wrong.
request are made as follow:
see the configuration:
configuration. |
|
@chicco785, regarding If so, check the You can better visualize this using the Policy Evaluation Tool, there you can check which permission/policy was evaluated and the outcome. |
|
@chicco785, regarding
|
|
@pedroigor clearly i need to better understand how it works. what do you mean by "protected" scopes? is then the only way then to an "affermative" aggregate permission to not conflict the policies? |
|
@chicco785, permissions are mutually exclusive by default. If Permission A gives access to scope A and Permission B denies access to scope A. Scope A will be denied. UMA permissions work differently as they override any other permission decision. Yeah, an aggregate policy marked as "affirmative" is a way to solve this problem. In this case you will have a single ṕermission for scope A and if any policy gives access then access will be granted. |
No description provided.