Skip to content

Commit

Permalink
feat(ras-visas-uinfo): include ga4gh_passport_v1 claim in userinfo re…
Browse files Browse the repository at this point in the history
…sponse
  • Loading branch information
vpsx committed Jul 1, 2020
1 parent 723fb34 commit 53b8025
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fence/resources/user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formatdate

from cdislogging import get_logger
import flask
import jwt
from cdislogging import get_logger

from fence.resources import userdatamodel as udm
from fence.resources.google.utils import (
Expand Down Expand Up @@ -128,6 +129,16 @@ def get_user_info(current_session, username):
optional_info = _get_optional_userinfo(user, requested_userinfo_claims)
info.update(optional_info)

# Include ga4gh passport visas
# TODO: Respect access token claims (only include if ga4gh_passport_v1 scope present)
decoded_visas = []
for visa_row in user.ga4gh_visas_v1:
encoded_visa = visa_row.ga4gh_visa
# OK to not verify on this end. Visas were verified on ingest.
decoded_visa = jwt.decode(encoded_visa, verify=False)
decoded_visas.append(decoded_visa)
info["ga4gh_passport_v1"] = decoded_visas

return info


Expand Down

0 comments on commit 53b8025

Please sign in to comment.