How do I configure jupyterhub with basic authentication with preset user name and password

I’ve set up a vanilla ZTJH hub running on a self-hosted single node workstation running K3S.

Simple/stupid question, but is there an option for an authenticator class that just takes a basic username and password set in a config file?

I see Authentication and authorization — Zero to JupyterHub with Kubernetes documentation demonstrates the authenticator class: “dummy” and then a bunch of external services. Is there an option for 'basic auth"?

Also the dummy authentication class is obviously great for testing but also a bit confusing, since it sets up a four dummy usernames with a shared password, but the vanilla setup allows any user using any password to login, so I don’t quite see the point of setting the four example users. Clearly I’m missing something here.

Thanks for the help, the docs are otherwise awesome and I’m very new to all this!

Try below config and let me know

Not for Z2JH, since there’s no local user database and pods are treated as ephemeral.

is probably the closest to what you want, users can sign-up themselves and wait for admin approval, and this also means the admin doesn’t have to deal with passwords.

Otherwise it’s fairly easy to implement your own Authenticator, with the major caveat that storing passwords in plain text is not good practice. This is the DummyAuthenticator

and if you’re familiar with Python it’s trivial to change that to a map of usernames and passwords.

Thanks so much for clarifying! Yup, nativeauthenticator looks great, didn’t see that one!

Very impressed with all the built-in authenticators and I’ll probably end up going with the GitHub authentication anyway, but I like knowing that I have a stand-alone option to test with and fall back on that doesn’t depend on external services.

1 Like