Search code examples
authorizationkeycloakkeycloak-services

Is there any way to get a set of resources detailed information from Keycloak server by using Keycloak rest endpoints


we have rest point to get the resource information from keycloak server.

  • http://{host}:{port}/auth/realms/{realm}/authz/protection/resource_set/{resource_id}

from this endpoint I can get only one resource information.

-{
    "name": "/TestResource",
    "type": "customer",
    "ownerManagedAccess": false,
    "displayName": "testresource",
    "_id": "****resource id****",
    "icon_uri": "testIconUri",
    "uris": [
        "/uri2",
        "/uri1"
    ],
    "resource_scopes": [
        {
            "name": "GET"
        }
    ]
 }

But, In my case i have more than 25 resources to be loaded in my menu of application.

If i go with above endpoint, i need to call the same service for more than 25 times . so i need some other way to get set of resources information using single endpoint.

I expect a solution for this, thankyou in advance.


Solution

  • I found the solution. we can get all the authorization related details using

    http://{host}:{port}/auth/admin/realms/{realmname}/clients/{clientId}/authz/resource-server/settings

    provided by keycloak.

    • we have to use admin credentials
    • {clientId} is not the Client Name given by you. it is generated by keycloak for each client