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

documentation for authentication #707

Merged
merged 4 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
74 changes: 74 additions & 0 deletions doc/authentication.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Enabling Authentication
=======================

By default BinderHub runs without authentication and
for each launch it creates a temporary user and starts a server for that user.

In order to enable authentication for BinderHub by using JupyterHub as an oauth provider,
you need to add the following into ``config.yaml``:

.. code:: yaml

config:
BinderHub:
auth_enabled: true

jupyterhub:
cull:
# don't cull authenticated users
users: False

hub:
services:
binder:
oauth_redirect_uri: "<binderhub_url>/oauth_callback"
bitnik marked this conversation as resolved.
Show resolved Hide resolved
oauth_client_id: "binder-oauth-client-test"
extraConfig:
binder: |
bitnik marked this conversation as resolved.
Show resolved Hide resolved
from kubespawner import KubeSpawner

class BinderSpawner(KubeSpawner):
def start(self):
if 'image' in self.user_options:
# binder service sets the image spec via user options
self.image_spec = self.user_options['image']
return super().start()
c.JupyterHub.spawner_class = BinderSpawner

singleuser:
# to make notebook servers aware of hub
cmd: jupyterhub-singleuser

auth: {}

bitnik marked this conversation as resolved.
Show resolved Hide resolved
.. note::
For `jupyterhub.auth` you should use config of your authenticator.
bitnik marked this conversation as resolved.
Show resolved Hide resolved
For more information you can check
`the Authentication guide
<https://zero-to-jupyterhub.readthedocs.io/en/stable/authentication.html>`_.

.. warning::
`jupyterhub-singleuser` requires `JupyterHub` to be installed in user server images.
bitnik marked this conversation as resolved.
Show resolved Hide resolved
Therefore ensure that you use at least `jupyter/repo2docker:ccce3fe` image
bitnik marked this conversation as resolved.
Show resolved Hide resolved
to build user images. Because `repo2docker` installs `JupyterHub` by default after that.
bitnik marked this conversation as resolved.
Show resolved Hide resolved

Authentication with named servers
---------------------------------

With above configuration Binderhub limits each authenticated user to start one server at a time.
When a user already has a running server, BinderHub displays an error message.

If you want to have users be able to launch multiple servers at the same time,
you have to enable named servers on JupyterHub:

.. code:: yaml

config:
BinderHub:
use_named_servers: true
jupyterhub:
hub:
allowNamedServers: true

.. note::
BinderHub assigns a unique name to each server with max 40 characters.
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ in the community have done.

debug
customizing
authentication
known-deployments

BinderHub Developer and Architecture Documentation
Expand Down