Search code examples
keycloakkeycloak-rest-api

How to add multiple owners on single resource in keycloak


I am working with keycloak UMA. With the help of keycloak I can create the resources in keycloak Authorization option with some basic details name, type, URI, scope, etc and we also have the option for resource owner, with UI we are not able to change the owner,

But I've some question regarding resource owner:

  • Is there any way to add multiple owners to resources (if using API). If yes then how?
  • If yes, then multiple owners can able to share that particular projects to others using username or email address

I've also tried with below CURL, but I am not able to add multiple owner names.

curl -v -X POST \
  http://${host}:${port}/auth/realms/${realm_name}/authz/protection/resource_set \
  -H 'Authorization: Bearer '$pat \
  -H 'Content-Type: application/json' \
  -d '{
     "name":"Alice Resource",
     "owner": "alice"
  }'

Solution

    • You can't assign multiple users as owners to a single resource. you can assign all the resource scopes to access to any users associated within keycloak.
    • Another user can able to share the resources with others on behalf of the resource owner if that particular user has the resource owner's token. You can get the resource owner token with the help token exchange or Impersonation feature provided by keycloak.
    • You can refer keycloak official documentation