Hello,
Intially Iam using keycloack for jupyterhub authentication.
Later we integrated it in anther application so with custom auth I logged into Jupyterhub by hitting below url:
http://192.168.49.2:30268/hub/login?next=&userId=sai
with below code
class MyAuthenticator(Authenticator):
@default("auto_login")
def _auto_login_default(self):
return True
async def authenticate(self, handler, data=None):
print('requested_sai')
user_id = handler.get_query_argument("userId", default="")
if user_id == "sairam":
return {name:user_id}
------other logic-----------
else:
return None
c.JupyterHub.authenticator_class = MyAuthenticator
I have successfully integrated custom authentication with JupyterHub using the MyAuthenticator class and the URL parameter userId. However, I now need to implement a fallback mechanism to redirect users to the Keycloak login page when the userId parameter is not provided in the URL.
Any guidance on modifying the MyAuthenticator class to accommodate this new behavior would be greatly appreciated.