New to using Keycloak and I am trying to understand assigning of roles to users. This is the format I use. I create roles and users and create groups with certain roles. I then assign users to groups to have the permissions based on roles in the group. Now I have difficulty in the following case.
Lets say I have 4 resources A, B, C, D
, 2 roles R1, R2
, 2 groups G1, G2
and a user U
.
R1
have permissions (i use these authorization scopes: read
, write
, create
, delete
) to access A, B
.
R2
have permissions to access only to A, B, C, D
resources.
G1
has role R1
and G2
has role R2
assigned to them.
Now I create a user U
and want to give him access to G1
hoping this user will have access to 2 mentioned resources. But that is not the case and I notice U
is not given access to any of the 4 resources. I will need to add this user to G2
as well to get access to all 4 resources which is not what I wanted.
Also in another case, if I want to add user to G2
, I expect him to have access to all 4 resources. But I notice that this user can only access C, D
. And I should add him to G1
as well to get access to all the resources.
I believe keycloak checks with an and
condition fashion in assigning permissions. Is there a way to define roles with resources exclusive to each other?