Skip to content

Commit

Permalink
debug auth
Browse files Browse the repository at this point in the history
  • Loading branch information
nkan-aot2 authored Nov 14, 2024
1 parent ba37f68 commit 2679a08
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions request-management-api/request_api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,18 @@ def decorated(f):
@wraps(f)
def wrapper(*args, **kwargs):
_groups = groups.split(',')
print(_groups)
token = jwt.get_token_auth_header()
unverified_claims = josejwt.get_unverified_claims(token)
usergroups = unverified_claims['groups']
usergroups = [usergroup.replace('/','',1) if usergroup.startswith('/') else usergroup for usergroup in usergroups]
exists = False
print(usergroups)
for group in _groups:
if group in usergroups:
exists = True
retval = "Unauthorized" , 401
print(exists)
if exists == True:
return f(*args, **kwargs)
return retval
Expand Down

0 comments on commit 2679a08

Please sign in to comment.