Skip to content

Commit

Permalink
Add JWT realm_access roles to audit logs. Keep in parity with front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul F Bugni committed Dec 24, 2024
1 parent d829f5d commit 2a5135d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sof_wrapper/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ def authorize():
extracted_id_token = extract_payload(token_response.get('id_token'))
username = extracted_id_token.get('preferred_username')
DEA = extracted_id_token.get('DEA')
roles = extracted_id_token.get('realm_access',{}).get('roles')

# standalone uses profile
if 'profile' in extracted_id_token:
session['user'] = session.get('user', extracted_id_token['profile'])
else:
session['user'] = session.get('user', {'username': username, 'DEA': DEA})
session['user'] = session.get('user', {'username': username, 'DEA': DEA, 'roles': roles})

if 'patient' in token_response:
session['subject'] = session.get('subject', 'Patient/{}'.format(token_response['patient']))
Expand Down

0 comments on commit 2a5135d

Please sign in to comment.