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

Allow configuration of OAuthenticator.scope #523

Merged
merged 4 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion images/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

# Allow switching authenticators easily
auth_type = get_config('auth.type')
auth_scopes = get_config('auth.scopes')
email_domain = 'local'

if auth_type == 'google':
Expand All @@ -139,7 +140,8 @@
org_whitelist = get_config('auth.github.org_whitelist', [])
if len(org_whitelist) != 0:
c.GitHubOAuthenticator.github_organization_whitelist = org_whitelist
c.GitHubOAuthenticator.scope = ['read:org'] # required for private membership
if not auth_scopes:
c.OAuthenticator.scope = ['read:org'] # required for private membership
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like the wrong place to embed the logic for default scopes. Maybe this should be left unset since it should work with public members of an org, and an example added to the docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense

elif auth_type == 'cilogon':
c.JupyterHub.authenticator_class = 'oauthenticator.CILogonOAuthenticator'
c.CILogonOAuthenticator.oauth_callback_url = get_config('auth.cilogon.callback-url')
Expand Down Expand Up @@ -186,6 +188,9 @@
else:
raise ValueError("Unhandled auth type: %r" % auth_type)

if auth_scopes:
c.OAuthenticator.scope = auth_scopes

c.Authenticator.enable_auth_state = get_config('auth.state.enabled', False)

def generate_user_email(spawner):
Expand Down
5 changes: 5 additions & 0 deletions jupyterhub/templates/hub/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ data:
auth.custom.config : {{ toJson .Values.auth.custom.config | quote }}
{{- end }}

{{ if .Values.auth.scopes -}}
auth.scopes: |
{{ toYaml .Values.auth.scopes | indent 4}}
{{- end }}

auth.state.enabled: {{ .Values.auth.state.enabled | quote }}

{{ if .Values.singleuser.lifecycleHooks -}}
Expand Down