Skip to content

Commit

Permalink
Add realm_access.roles from JWT claims (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 c9c8526 commit 433ff0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion patientsearch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ def current_user_info(token):
DEA = oidc.user_getfield("DEA")
except Exception:
DEA = "unknown"
return {"username": username, "DEA": DEA}
try:
roles = oidc.user_getfield("realm_access")["roles"]
except Exception:
roles = []
return {"username": username, "DEA": DEA, "roles": roles}


@api_blueprint.route("/home", methods=["GET"])
Expand Down

0 comments on commit 433ff0a

Please sign in to comment.