From 532b080c2b9d193f02608219c79c7f096bf28b21 Mon Sep 17 00:00:00 2001 From: Data Lab User Date: Mon, 20 Nov 2023 21:29:41 -0700 Subject: [PATCH 1/3] minor version bump --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b0cb182..b0b1aef 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='dlauthenticator', - version='0.4.0', + version='0.4.1', description='Data Lab Authenticator for JupyterHub', url='https://github.com/astro-datalab/dlauthenticator', author='Mike Fitzpatrick', From ecca2719cedb993d49f50553d5dd0a314b91c1fb Mon Sep 17 00:00:00 2001 From: Data Lab User Date: Mon, 20 Nov 2023 21:30:50 -0700 Subject: [PATCH 2/3] fix forwarding on gp02 --- dlauthenticator/dlauthenticator.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dlauthenticator/dlauthenticator.py b/dlauthenticator/dlauthenticator.py index fe2f1d0..1d08518 100644 --- a/dlauthenticator/dlauthenticator.py +++ b/dlauthenticator/dlauthenticator.py @@ -4,8 +4,8 @@ # GCDLAUTHENTICATOR -- GC JupyterHub authenticator - ISS -__version__ = '0.4.0' -__author__ = 'Mike Fitzpatrick ' +__version__ = '0.4.1' +__author__ = 'Mike Fitzpatrick ' import os @@ -29,24 +29,24 @@ if DEF_SERVICE_ROOT is None: THIS_HOST = socket.gethostname() - if THIS_HOST[:5] == 'dldev': - DEF_SERVICE_ROOT = "https://dldev.datalab.noirlab.edu" - elif THIS_HOST[:6] == 'dltest': - DEF_SERVICE_ROOT = "https://dltest.datalab.noirlab.edu" + if THIS_HOST[:4] == 'gp02': + DEF_SERVICE_ROOT = f"https://gp02.datalab.noirlab.edu" else: - DEF_SERVICE_ROOT = "https://datalab.noirlab.edu" + DEF_SERVICE_ROOT = f"https://datalab.noirlab.edu" # Typically the terraform environment will set the # JHUB_DN_NAME env variable JHUB_DNS_NAME = os.environ.get('JHUB_DNS_NAME') -if JHUB_DNS_NAME is None: +if THIS_HOST[:4] == 'gp02': + DL_LOGIN_NEXT_URL = f"https://gp02.datalab.noirlab.edu" +elif JHUB_DNS_NAME is None: DL_LOGIN_NEXT_URL = f"{DEF_SERVICE_ROOT}/devbooks/" else: DL_LOGIN_NEXT_URL = f"https://{JHUB_DNS_NAME}" DEF_SERVICE_URL = DEF_SERVICE_ROOT + "/auth" - + # Make the runtime path to the debug user file accessible only to somebody # with admin privs on the machine running the authenticator. From e1db469405a45ae87f75548c894649aa0d55c28c Mon Sep 17 00:00:00 2001 From: Data Lab User Date: Tue, 21 Nov 2023 19:31:06 -0700 Subject: [PATCH 3/3] debugging --- dlauthenticator/dlauthenticator.py | 16 +++++++++++++--- setup.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dlauthenticator/dlauthenticator.py b/dlauthenticator/dlauthenticator.py index 1d08518..fb5396a 100644 --- a/dlauthenticator/dlauthenticator.py +++ b/dlauthenticator/dlauthenticator.py @@ -38,6 +38,7 @@ # JHUB_DN_NAME env variable JHUB_DNS_NAME = os.environ.get('JHUB_DNS_NAME') if THIS_HOST[:4] == 'gp02': + DEF_SERVICE_ROOT = f"https://datalab.noirlab.edu" DL_LOGIN_NEXT_URL = f"https://gp02.datalab.noirlab.edu" elif JHUB_DNS_NAME is None: DL_LOGIN_NEXT_URL = f"{DEF_SERVICE_ROOT}/devbooks/" @@ -46,6 +47,7 @@ DEF_SERVICE_URL = DEF_SERVICE_ROOT + "/auth" + # Make the runtime path to the debug user file accessible only to somebody # with admin privs on the machine running the authenticator. @@ -165,15 +167,19 @@ def post_authenticate(self, handler, data, token): class DataLabAuthenticator(BaseDataLabAuthenticator): """ Data Lab Jupyter token authenticator. - Notice this class doesn't perform a log in proper, that happens on the datalab login - form, which sets a cookie with the login token in the browser, is that token the - one that is used in the is class to authenticate the user. + Notice this class doesn't perform a log in proper, that happens on the + datalab login form, which sets a cookie with the login token in the + browser, is that token the one that is used in the is class to + authenticate the user. """ post_logout_url = f"{DEF_SERVICE_ROOT}/account/logout.html" invalid_token_url = f"{DEF_SERVICE_ROOT}/account/login.html?next={DL_LOGIN_NEXT_URL}" def __init__(self, parent=None, db=None, _deprecated_db_session=None): self.auto_login = True + self.log.info(f"THIS_HOST :{THIS_HOST}") + self.log.info(f"DEF_SERVICE_URL :{DEF_SERVICE_URL}") + self.log.info(f"DL_LOGIN_NEXT_URL :{DL_LOGIN_NEXT_URL}") @gen.coroutine def authenticate(self, handler, data): @@ -188,6 +194,8 @@ def authenticate(self, handler, data): # if we do not have the token then we can just route to login if dl_token is None: + self.log.info(f"NULL token :{dl_token}") + self.log.info(f"NULL redirect :{self.invalid_token_url}") handler.redirect(self.invalid_token_url) return None @@ -207,6 +215,8 @@ def authenticate(self, handler, data): self.log.info(f"Using debug user info for user:{username}") return self.post_authenticate(handler, debug_user_info, None) + self.log.info(f"Invalid token redirect :{dl_token}") + self.log.info(f"Invalid redirect :{self.invalid_token_url}") handler.redirect(self.invalid_token_url) return None else: diff --git a/setup.py b/setup.py index b0b1aef..6f6155f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='dlauthenticator', - version='0.4.1', + version='0.4.2', description='Data Lab Authenticator for JupyterHub', url='https://github.com/astro-datalab/dlauthenticator', author='Mike Fitzpatrick',