Skip to content

Commit

Permalink
✨ adding user information
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianazioti committed Feb 24, 2023
1 parent dc42076 commit 680d387
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bdc_auth_client/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def wrapped(*args, **kwargs):
kwargs.update(dict(roles=res['sub']['roles'] or []))
kwargs.update(dict(access_token=access_token))
kwargs.update(dict(user_id=res.get('user_id', None)))
kwargs.update(dict(user=res['sub']['user'] or []))


else:
session = OAuth2Session(
Expand Down Expand Up @@ -104,9 +106,11 @@ def wrapped(*args, **kwargs):
abort(403, HTTP_403_MSG)

user_roles = res['sub'].get('roles', [])
user = res['sub'].get('user', [])
kwargs.update(dict(roles=user_roles))
kwargs.update(dict(access_token=access_token))
kwargs.update(dict(user_id=res.get('user_id', None)))
kwargs.update(dict(user=user))
for key, value in res['sub'].items():
if key != 'roles':
kwargs.update({key: value})
Expand Down

0 comments on commit 680d387

Please sign in to comment.