I've just setup my first Keycloak server to offer SSO between two applications. These are not Java applications, and one is connected with SAML-2
and the other with OpenID
Connect.
So in Keycloak I have Realm-1
, and then Client-1
(application1
) and Client-2
(application2
) and user-1
and user-2
.
Now I want user-1
to only be allowed access to Client-1
, and user-2
to be allowed access to both Client-1
and Client-2
. Should be simple enough.
I have tried to read up on Roles and Authorization, but I find the documentation(or maybe just the topic) very confusing. I have been playing around with it with no success. I was expecting an interface to just map a group to a Client, and restrict access to the Clients by adding/removing users from groups.
Client scopes are entities in Keycloak, which are configured at the realm level and they can be linked to clients. The client scopes are referenced by their name when a request is sent to the Keycloak authorization endpoint with a corresponding value of the scope parameter.
This is a very simple example using RBAC policies to govern access to your resources. However, Keycloak supports other types of policies that you can use to perform even more fine-grained access control.
If you are using SAML:
user.hasRole(realm.getRole("yourRoleName"))
). If you are using openid, look at the comment in this thread
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