I want to create a jupyterhub installation that uses a custom redirect to authenticate the user. The user would enter the url to our Jupyterhub, be redirected to a separate authentication system, then returned to the app, bypassing login.html. It seems initially a lot of hacking would be needed on the actual Jupyterhub source code to make this work.
From what I understand currently we would need customize jupyterhub/jupyterhub/handlers/login.py jupyterhub/auth.py. We wanted to avoid that and use the officially supported mechanisms. I thought maybe I could create my own Authenticator for use in a config file as in
c = get_config()
c.Authenticator.stuffGoesHere
and implement my own:
class LoginHandler(BaseHandler) // login.py
in addition to
class Authenticator(LoggingConfigurable): // auth.py
But I don't even see clearly how to do this as I cannot figure out where
get_config()
is implemented and how to override this. Am I overthinking this? Whats the solution to wanting a separate system to handle the login (we can get the username from this external system for docker provisioning etc for dockerspawner). Btw, where is get_config actually defined?
jupyter_notebook_config.py —This file is saved in the /etc/jupyter/ directory by default and copied to the jupyterhub container as the default. For more information, see Config file and command line options in the Jupyter Notebook documentation.
Open the Control Panel by clicking the control panel button on the top right of your JupyterHub. In the control panel, open the Admin link in the top left. This opens up the JupyterHub admin page, where you can add / delete users, start / stop peoples' servers and see who is online. Click the Add Users button.
How can I change my password? To change your password, you should login in your jupyterhub account, go to <your_server_ip>/hub/auth/change-password and change the password.
The get_config
is defined here: https://github.com/ipython/traitlets/blob/c5c9166373041dd561d8ad86e8990ae844d26306/traitlets/config/loader.py#L483-L501
And the reason you can use it directly without importing first is py3compat.execfile
.
Back to your need, what you should do is create your CustomizedAuthenticator
class which extends the jupyterhub.auth.Authenticator
. And use it with:
c.JupyterHub.authenticator_class = CustomizedAuthenticator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With