Search code examples
pythonjupyter-notebookjupyter-labjupyterhubauthenticator

How to check which authenticator_class is used by jupyterhub without reading jupyterhub_config file?


I'm dynamically setting different authenticator class in jupyterhub_config file.

jupyterhub_config.py

c.JupyterHub.authenticator_class = "authenticator_A"

Now i want to check which autheticator is used in notebook cell. How can i get this class without reading the file?


Solution

  • I'm creating environment variable to store authenticator class name in jupyter_config.py file like below,

    c.Spawner.environment = {"AUTHENTICATOR_CLASS": "authenticator_A"}

    And using this AUTHENTICATOR_CLASS env variable in notebook.

    https://jupyterhub.readthedocs.io/en/stable/api/spawner.html#jupyterhub.spawner.Spawner.environment