Keycloak is a great tool, but it lacks proper documentation.
So we have Realm.roles, Client.roles and User.roles
How do there 3 work together when accessing an application using a specific client?
Sincerely,
Keycloak provides the concept of a client scope for this. Clients can define roles that are specific to them. This is basically a role namespace dedicated to the client. A token that provides identity information about the user.
To assign a user a role: Under the users section in Keycloak, click the user's ID (if there are missing users, click “View all users”). In the role mappings tab, select the GeoStore client from the client roles dropdown.
Resource Sharing Resource owners are allowed to manage permissions to their resources and decide who can access a particular resource and how. {project_name} can then act as a sharing management service from which resource owners can manage their resources.
For instance, to allow access to a group of resources only for users granted with a role "User Premium", you can use RBAC (Role-based Access Control). Keycloak provides a few built-in policy types (and their respective policy providers) covering the most common access control mechanisms.
In KeyCloak we have those 3 roles:
There are no User Roles in KeyCloak. You most likely confused that with User Role Mapping, which is basically mapping a role (realm, client, or composite) to the specific user
In order to find out how these roles actually work, let's first take a look at a simple Realm model I created. As you can see in picture below, every Realm has one or multiple Clients. And every Client can have multiple Users attached to it.
Now from this it should be easy to conclude how role mappings work.
Realm Role: It is a global role, belonging to that specific realm. You can access it from any client and map to any user. Ex Role: 'Global Admin, Admin'
Client Role: It is a role which belongs only to that specific client. You cannot access that role from a different client. You can only map it to the Users from that client. Ex Roles: 'Employee, Customer'
Composite Role: It is a role that has one or more roles (realm or client ones) associated to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With