I have an organization that uses keycloak for SSO and they manage an identity store using ADFS (Identity Provider) and ldap (User federation). The only attributes that I can use are UPN and email. Both have @ in the username. Is there a way to replace @ with _ so Kubernetes labels an urls are same through out? This is the last step I need to have a working notebook 500+ users are looking forward to use.
You can subclass your authenticator and override normalize_username
, something like
hub:
extraConfig:
SpawnerCustomConfig: |
from ldapauthenticator import LDAPAuthenticator
class LDAPAuthenticatorCustom(LDAPAuthenticator):
def normalize_username(self, username):
...
return modified_username
c.JupyterHub.authenticator_class = LDAPAuthenticatorCustom