-
Notifications
You must be signed in to change notification settings - Fork 106
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
Enhancement - Feature to add keycloak roles to the created user #144
base: main
Are you sure you want to change the base?
Enhancement - Feature to add keycloak roles to the created user #144
Conversation
Registry enhancement - Feature to add keycloak roles to the users
Hi @dileepbapat We have implemented this feature as part of Swasth Health Claims Exchange registry use case and we would like to contribute back to Sunbird-RC, Can you please review the PR and share your feedback. |
@shiva-rakshith, |
@tejash-jl - In that scenario, roles will be common to all the users and no differentiation. For example, I have an organization entity, in which different users will have different roles. It seems that this cannot be achieved with above suggested solution. Could you please confirm? |
I think this can be done outside SB-RC as it is part of custom use-case implementation. |
Usecase scenario:
Creating a user in the registry will create a user in keycloak. currently, we don't have any feature in registry to add keycloak roles to users.
Adding keycloak roles to users, will help to give different privileges to users. For example, we can give access to different users to different APIs based on their roles, which can be extracted from JWT token(as it contains role information).
Sample request body with
roles
:The
roles
property should be of typeList
, as multiple roles can be assigned to a person.Whatever the roles is passed in the request body, the same will be added to user in keycloak. If
roles
property is not define in the request body, registry will consider that as empty list and no role will be added.Configuration changes:
(keycloak -> roles -> add role)
( Keycloak -> open client(which is configured as client_id in application.yml) -> Service Account Roles -> Client Roles, select 'realm-management' -> Assign 'view-realm' role)
Future enhancements:
Discussion link: Sunbird-RC/community#178