updated to decoded.get to avoid KeyError while getting 'aud'
Change-Id: I33cad322c21677af27b5df39acaa26cddd2f85e1
This commit is contained in:
parent
47fd843000
commit
8afc9de172
@ -143,7 +143,7 @@ class KeycloakAuthMiddleware(base_middleware.Middleware):
|
||||
# Get user realm from parsed token
|
||||
# Format is "iss": "http://<host>:<port>/auth/realms/<realm_name>",
|
||||
__, __, realm_name = decoded['iss'].strip().rpartition('/realms/')
|
||||
audience = decoded['aud']
|
||||
audience = decoded.get('aud')
|
||||
|
||||
# Get roles from from parsed token
|
||||
roles = ','.join(decoded['realm_access']['roles']) \
|
||||
|
Loading…
Reference in New Issue
Block a user