Skip to content

Commit

Permalink
Encode before hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
enolfc committed Sep 27, 2024
1 parent ddeb555 commit 2604b3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion egi_notebooks_hub/egiauthenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,10 @@ def user_info_to_username(self, user_info):
raise e
# let's treat this as an anonymous user with a name
# that's generated as a hash of user_info
info_str = json.dumps(user_info, sort_keys=True).encode("utf-8")
return "{0}-{1}".format(
self.anonymous_username_prefix,
hashlib.sha256(json.dumps(user_info, sort_keys=True)).hexdigest(),
hashlib.sha256(info_str).hexdigest(),
)

async def jwt_authenticate(self, handler, data=None):
Expand Down

0 comments on commit 2604b3e

Please sign in to comment.