python-keycloak
python-keycloak copied to clipboard
Ressource Access
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.
Example is impossible to follow without the file content ("example-authz-config.json").
Any idea what example-authz-config.json suppose to look like?
Any idea what
example-authz-config.jsonsuppose 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.
Any idea what
example-authz-config.jsonsuppose 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.
Follow this. click on clients, then click your client, then Authorization, then there's the export option.