-
Notifications
You must be signed in to change notification settings - Fork 367
Open
Labels
Description
I am trying to use ORCID with CILogonOAuthenticator, with the following config
allowed_idps:
http://orcid.org/oauth/authorize:
username_derivation:
username_claim: "oidc"
allow_all: trueBut unfortunately this produces usernames like https://orcid.org/<id>, which aren't valid (because of the / and :). So all logins fail. I tried various other username_claims but none of them actually just produce the user id.
I am currently using this additional claim:
def setup_orcid_username(authenticator, handler, authentication):
"""
Fish ORCID username from inside cilogon_user when used with ORCID
There is no clear way to get just the ORCID id from CILogon, so we
have to
"""
print(authentication, flush=True)
idp = authentication['auth_state']['cilogon_user']['idp']
if idp == 'http://orcid.org/oauth/authorize':
authentication['name'] = authentication['auth_state']['cilogon_user']['oidc'].split('/')[-1]
return authentication
c.Authenticator.post_auth_hook = get_orcid_usernameAnd then using given_name as the username_claim. But it's never used, as we replace it with the split from oidc.
We should find some other way to extract such custom parts out of claims for username_claim. The easiest thing probably is to allow username_claim to be also a callable.
Reactions are currently unavailable