Skip to content

Commit

Permalink
removed introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Oct 8, 2024
1 parent 863425f commit 6b91ef3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion permissions/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ async def get_user_info(access_token):
LOG.error(user_info)
user = None

'''
async with ClientSession() as session:
async with session.post(idp_introspection,
auth=BasicAuth(idp_client_id, password=idp_client_secret),
Expand All @@ -117,6 +118,7 @@ async def get_user_info(access_token):
LOG.error('Invalid token')
user = 'public'
return user, list_visa_datasets
'''

async with ClientSession(trust_env=True) as session:
headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' + access_token }
Expand All @@ -125,6 +127,7 @@ async def get_user_info(access_token):
LOG.error('Response %s', resp)
if resp.status == 200:
user = await resp.json()
LOG.error(user)
try:
visa_datasets = user['ga4gh_passport_v1']
if visa_datasets is not None:
Expand Down Expand Up @@ -165,6 +168,7 @@ async def decorated(request):
# We make a round-trip to the userinfo. We might not have a JWT token.
try:
user, list_visa_datasets = await get_user_info(access_token)
LOG.error(user)
except Exception:
user = 'public'
LOG.info('The user is: %r', user)
Expand All @@ -174,7 +178,7 @@ async def decorated(request):
username = 'public'
else:
username = user.get('preferred_username')
LOG.debug('username: %s', username)
LOG.error('username: %s', username)

return await func(request, username, list_visa_datasets)
return decorated

0 comments on commit 6b91ef3

Please sign in to comment.