jwtauthenticator
jwtauthenticator copied to clipboard
How to normalize username names from Google IAP
Hi
I'm using the authenticator and the feature to create users dynamically, but when using Google IAP I'm getting the following error:
File "/home/sa_124215213123/.local/lib/python3.8/site-packages/jupyterhub/auth.py", line 909, in add_system_user
raise RuntimeError("Failed to create system user %s: %s" % (name, err))
RuntimeError: Failed to create system user [email protected]: adduser: invalid option -- 'q'
Usage: adduser [options] LOGIN
adduser -D
adduser -D [options]
Is there a way to normalize, strip of the domain name ?
c.JupyterHub.spawner_class = 'systemdspawner.SystemdSpawner'
c.SystemdSpawner.dynamic_users = True
c.Spawner.notebook_dir = "notebooks"
c.Spawner.default_url = '/lab'
# Authentication
lib_dir = pjoin(os.path.dirname(this_dir), "lib")
sys.path.append(lib_dir)
c.JupyterHub.authenticator_class = 'jwtauthenticator.jwtauthenticator.JSONWebTokenLocalAuthenticator'
c.JSONWebTokenLocalAuthenticator.create_system_users = True
c.JSONWebTokenLocalAuthenticator.header_name = 'x-goog-iap-jwt-assertion'
#c.JSONWebTokenAuthenticator.header_is_authorization = False
c.JSONWebTokenLocalAuthenticator.expected_audience = '/projects/xxxxx/global/backendServices/xxxxx'
c.JSONWebTokenLocalAuthenticator.username_claim_field = 'email'
c.JSONWebTokenLocalAuthenticator.secret = request.urlopen('https://www.gstatic.com/iap/verify/public_key').read()
This should work: https://github.com/mogthesprog/jwtauthenticator/blob/master/jwtauthenticator/jwtauthenticator.py#L86
So no idea. Thanks for any advice.