Browse Source

updated to decoded.get to avoid KeyError while getting 'aud'

Change-Id: I33cad322c21677af27b5df39acaa26cddd2f85e1
changes/43/681443/1
kushalagrawal 1 week ago
parent
commit
8afc9de172
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      glare/api/middleware/keycloak_auth.py

+ 1
- 1
glare/api/middleware/keycloak_auth.py View File

@@ -143,7 +143,7 @@ class KeycloakAuthMiddleware(base_middleware.Middleware):
143 143
         # Get user realm from parsed token
144 144
         # Format is "iss": "http://<host>:<port>/auth/realms/<realm_name>",
145 145
         __, __, realm_name = decoded['iss'].strip().rpartition('/realms/')
146
-        audience = decoded['aud']
146
+        audience = decoded.get('aud')
147 147
 
148 148
         # Get roles from from parsed token
149 149
         roles = ','.join(decoded['realm_access']['roles']) \

Loading…
Cancel
Save