-
Notifications
You must be signed in to change notification settings - Fork 802
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
Conversation
images/hub/jupyterhub_config.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense
I've removed the default GitHub scope. I can update the docs after #515 is merged |
images/hub/jupyterhub_config.py
Outdated
@@ -186,6 +185,8 @@ | |||
else: | |||
raise ValueError("Unhandled auth type: %r" % auth_type) | |||
|
|||
c.OAuthenticator.scope = get_config('auth.scopes', []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overrides the default of the chosen OAuthenticator to an empty list if unset in the helm chart.
To avoid this, use a condition:
auth_scopes = get_config('auth.scopes')
if auth_scopes:
c.OAuthenticator.scope = auth_scopes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Thanks! |
Follow-up to #501
This allows
OAuthenticator.scope
to be set. The default isempty.[read:org]
ifauth.github.org_whitelist
is set, otherwiseExamples with Github.
auth.github.org_whitelist
unset,auth.scopes
unset:auth.github.org_whitelist
set,auth.scopes
set to[read:org]
:auth.github.org_whitelist
set,auth.scopes
set to[read:org, read:user, user:email]
:In theory this property should also work with other OAuth providers, but I don't have an easy way to test.