Skip to content

Commit

Permalink
Merge pull request #39 from fabianazioti/b-0.4
Browse files Browse the repository at this point in the history
✨ adding user information
  • Loading branch information
raphaelrpl authored Feb 24, 2023
2 parents dc42076 + ecac7c9 commit 37428c7
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 None))


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', None)
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 37428c7

Please sign in to comment.