Hello, members.
Goal
I would like to query a LDAP server after AzureAD Authentication in a Z2JH environment.
It is necessary to set some parameters like NB_UID
, NB_GID
, CHOWN_HOME
and so on.
I succeed AzureAD authentication.
Questions
Could you tell me how to call a hook method like pre_spawn_start
?
I found the following message, so It use the AzureAdOAuthenticatorInfo
class.
[I 2024-09-25 13:10:15.006 JupyterHub app:2889] Using Authenticator: builtins.AzureAdOAuthenticatorInfo
I expect show pre_spawn_start *********************
in log file. but It doesn’t show in the log.
Configuration example
debug:
enabled: true
hub:
config:
Authenticator:
enable_auth_state: true
allowed_users:
- alice@example.com
AzureAdOAuthenticator:
client_id: "client_id"
client_secret: "secret"
oauth_callback_url: https://example.com/hub/oauth_callback
tenant_id: tenant_id
scope:
- openid
- profile
username_claim: "unique_name"
#JupyterHub:
# authenticator_class: azuread
extraConfig:
SpawnerCustomConfig: |
from oauthenticator.azuread import AzureAdOAuthenticator
from hashlib import md5
class AzureAdOAuthenticatorInfo(AzureAdOAuthenticator):
async def pre_spawn_start(self, user, spawner):
self.log.debug(f"pre_spawn_start *********************")
auth_state = await user.get_auth_state()
self.log.debug(f"pre_spawn_start *********************")
self.log.debug(f"pre_spawn_start auth_state: {auth_state}")
self.log.debug(f"pre_spawn_start *********************")
c.JupyterHub.authenticator_class = AzureAdOAuthenticatorInfo
Environment
- Jupyterhub: 3.1.0
- App Version: 4.0.2
- k8s: v1.28.2
- OS: Ubuntu 22.04