-
Notifications
You must be signed in to change notification settings - Fork 390
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 authentication #666
Conversation
binderhub/tests/conftest.py
Outdated
cfg.BinderHub.use_oauth = False | ||
cfg.BinderHub.use_named_servers = False | ||
|
||
os.environ['JUPYTERHUB_API_TOKEN'] = cfg.BinderHub.hub_api_token |
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.
Since the class has been imported already, setting the environment variable here is too late. Instead, we can set cfg.HubAuthenticated.api_token = cfg.BinderHub.hub_api_token
directly. Same, I imagine, for the other environment variables. Set config values directly instead of relying on environment variables.
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.
Did you mean cfg.HubOAuth.api_token = cfg.BinderHub.hub_api_token
instead of cfg.HubAuthenticated.api_token = cfg.BinderHub.hub_api_token
?
But still I don't understand how this is going to configure HubOAuth
. This configuration in tests is only used here to create a bhub instance.
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.
I think reading https://traitlets.readthedocs.io/en/latest/config.html will help me to figure out how to do this
I don't think so. The switch here doesn't seem to be related to jupyterhub's own authenticator choice. |
binderhub/launcher.py
Outdated
) | ||
body = json.loads(resp.body.decode('utf-8')) | ||
return body | ||
|
||
def username_from_repo(self, repo_url): |
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.
Maybe rename it to unique_name_from_repo
now that it generates more than just a username.
binderhub/launcher.py
Outdated
username, e, body, | ||
) | ||
raise web.HTTPError(500, "Failed to create temporary user for %s" % image) | ||
elif server_name == '': |
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.
elif server_name == '':
-> elif server_name:
should be enough to check if a string is not empty.
03c321f
to
7004ada
Compare
hmm I don't understand why Btw I did all changes that you requested. |
hub: | ||
services: | ||
binder: | ||
url: http://10.0.2.2:8585 |
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 hardcoded ip may not be stable for any given deployment
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.
true, this IP is only for when VirtualBox driver is used
This reverts commit 51a53df.
only when VirtualBox drive is used. minikube runs on travis without VM driver. try to get and use host IP.
@minrk tests passed after I replaced |
Awesome, thanks! |
boom! this one has been a long time coming! really nice @bitnik :-) |
finally :) thanks to all of you! |
This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/a-persistent-binderhub-deployment/2865/1 |
Clean version of #596.
From #596:
Maybe I don't understand what @minrk meant here. I still think that we need 2 flags:
auth_enabled
is to hold if authentication is enabled anduse_oauth
is to hold if an authenticator from https://github.com/jupyterhub/oauthenticator is used.I started writing tests but I am not sure what I did is right.
There is already a problem while running auth tests locally. The problem is that
HubAuth.api_token
is not filled withJUPYTERHUB_API_TOKEN
env variable by default (https://github.com/jupyterhub/jupyterhub/blob/master/jupyterhub/services/auth.py#L172). As a workaround I added the dynamic default value generator forapi_token
injupyterhub/services/auth.py
:When I do this, tests work locally. Is this a bug in JupyterHub or is the way I did auth tests wrong?