the-littlest-jupyterhub icon indicating copy to clipboard operation
the-littlest-jupyterhub copied to clipboard

Native Authenticator not working after configuration

Open piskernik opened this issue 11 months ago • 1 comments

Bug description

In Issue 295 a workaround was stated, to bring Native Authenticator to work, however som critical additional information is missing

How to reproduce

apt-get update && apt-get upgrade
apt install python3 python3-dev git curl
curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin adminusername
sudo tljh-config set auth.type nativeauthenticator.NativeAuthenticator
sudo tljh-config set auth.NativeAuthenticator.admin_users adminusername
sudo tljh-config set auth.NativeAuthenticator.allow_all True
sudo tljh-config reload

This will not allow login of the adminusername.

Work-around

In contrast you need to do the following:

apt-get update && apt-get upgrade
apt install python3 python3-dev git curl
curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin adminusername
sudo tljh-config set auth.type nativeauthenticator.NativeAuthenticator
sudo tljh-config set auth.NativeAuthenticator.admin_users otheradminusername
sudo tljh-config set auth.NativeAuthenticator.allow_all True

Then cd /opt/tljh/config/jupyterhub_config.d/ and create a new file:

nano NativeAuthenticator.py

Paste this into it:

import os, nativeauthenticator
c.JupyterHub.template_paths = [f"{os.path.dirname(nativeauthenticator.__file__)}/templates/"]

Save it with CTRL-X and Yes and then sudo tljh-config reload

Now REGISTER as new user with otheradminusername. 
You will get access.

### Expected behavior
Of course it would be good, if no workaround would be necessary. At least the workaround should be described in the documentation for native authenticator.

piskernik avatar Jan 06 '25 09:01 piskernik

The reason is, that the jupyterhub.sqlite database in /opt /tljh/state is not prepopulated with the existing user, when the change to Native Authenticator occurs.

piskernik avatar Jan 06 '25 17:01 piskernik