Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ORCID & GitHub auth for AGU Binder #3524

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion config/clusters/2i2c/agu-binder.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ binderhub:
extraVolumeMounts:
- name: custom-templates
mountPath: /etc/binderhub/custom

jupyterhub:
ingress:
enabled: true
Expand All @@ -69,6 +68,25 @@ binderhub:
scopes:
- self
- "access:services"
extraConfig:
01-orcid: |
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 do this. https://github.com/jupyterhub/oauthenticator/issues/712
is the upstream report, we can get rid of this once that gets fixed.
"""
idp = authentication['auth_state']['cilogon_user']['idp']
if idp == 'http://orcid.org/oauth/authorize':
# Only modify usernames if orcid is used
# oidc is of the form https://orcid.org/<orcid-id>
authentication['name'] = authentication['auth_state']['cilogon_user']['oidc'].split('/')[-1]
return authentication

c.Authenticator.post_auth_hook = setup_orcid_username

config:
BinderSpawner:
auth_enabled: true
Expand All @@ -80,6 +98,14 @@ binderhub:
http://google.com/accounts/o8/id:
username_derivation:
username_claim: "email"
http://orcid.org/oauth/authorize:
username_derivation:
username_claim: "given_name"
allow_all: true
http://github.com/login/oauth/authorize:
username_derivation:
username_claim: "preferred_username"
allow_all: true
Authenticator:
admin_users:
- [email protected]
Expand Down