Skip to content

Commit

Permalink
(PXP-4777) Feat/synapse userid (#739)
Browse files Browse the repository at this point in the history
* feat(synapse): use userid as username

* fix(synapse): use email from synapse
  • Loading branch information
mfshao authored Dec 4, 2019
1 parent 9d96c91 commit f5a712b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fence/blueprints/login/synapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self):

def post_login(self, user, token_result):
user.id_from_idp = token_result["sub"]
user.email = token_result["email_verified"]
user.email = token_result["email"]
user.display_name = "{given_name} {family_name}".format(**token_result)
info = {}
if user.additional_info is not None:
Expand Down
5 changes: 2 additions & 3 deletions fence/resources/openid/synapse_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ class SynapseOauth2Client(Oauth2ClientBase):
"""

REQUIRED_CLAIMS = {"given_name", "family_name", "email", "email_verified"}
REQUIRED_CLAIMS = {"given_name", "family_name", "email", "email_verified", "userid"}
OPTIONAL_CLAIMS = {
# "company",
# "userid",
# "orcid",
# "is_certified",
# "is_validated",
Expand Down Expand Up @@ -125,7 +124,7 @@ def get_user_id(self, code):
return dict(error="Required claim {} not found".format(claim))
else:
rv[claim] = value
rv["fence_username"] = rv["email"] + " (via Synapse)"
rv["fence_username"] = rv["userid"] + " (Synapse ID)"
return rv
except Exception as e:
self.logger.exception("Can't get user info")
Expand Down

0 comments on commit f5a712b

Please sign in to comment.