python-keycloak icon indicating copy to clipboard operation
python-keycloak copied to clipboard

Ressource Access

Open ChristianGeng opened this issue 5 years ago • 4 comments
trafficstars

I am getting an error thrown in line 381on the last version from pypi.

        user_resources = token_info['resource_access'].get(self.client_id)

        if not user_resources:
            return None

The trace is this:


     17 token = keycloak_openid.token("ddawson", "daniel")
     18 keycloak_openid.load_authorization_config(fname) # "example-authz-config.json"
---> 19 policies = keycloak_openid.get_policies(token['access_token'], method_token_info='decode', key=KEYCLOAK_PUBLIC_KEY)

~/.venvs/py37/lib/python3.7/site-packages/keycloak/keycloak_openid.py in get_policies(self, token, method_token_info, **kwargs)
    378                 "Token expired or invalid."
    379             )
--> 380 
    381         user_resources = token_info['resource_access'].get(self.client_id)
    382 

KeyError: 'resource_access'

token_info

So it does not reach

        if not user_resources:
            return None

altogether. Is this the desired behavior? Or are the no usefult Scenarios in which you do not have ressources? I would have expected to be able to get down to read policies even in such a case.

ChristianGeng avatar Jul 23 '20 07:07 ChristianGeng

Example is impossible to follow without the file content ("example-authz-config.json").

double-a avatar Apr 09 '21 19:04 double-a

Any idea what example-authz-config.json suppose to look like?

ychen-ot avatar Mar 03 '22 15:03 ychen-ot

Any idea what example-authz-config.json suppose to look like?

You can find this file in 1. go to clients 2. then clink on authorization 3. then at last you can find an export option.

lokeish avatar Sep 16 '22 09:09 lokeish

Any idea what example-authz-config.json suppose to look like?

You can find this file in 1. go to clients 2. then clink on authorization 3. then at last you can find an export option.

image Follow this. click on clients, then click your client, then Authorization, then there's the export option.

ondiekisteven avatar Dec 14 '23 10:12 ondiekisteven