From 7a41d24606c0ea030fc54d7e483d3ebf9526bb6d Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 30 Aug 2017 14:07:20 +0200 Subject: [PATCH] set cookie on singleuser when authenticated with ?token=... Allows `/user/name?token=...` URL to login users for more than one request. matches token behavior of regular notebook server. --- jupyterhub/services/auth.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jupyterhub/services/auth.py b/jupyterhub/services/auth.py index 32e999ae..a754e706 100644 --- a/jupyterhub/services/auth.py +++ b/jupyterhub/services/auth.py @@ -731,6 +731,11 @@ class HubAuthenticated(object): except Exception: self._hub_auth_user_cache = None raise + token = self.get_argument('token', '') + if user_model and token and getattr(self, '_token_authenticated', False): + # authenticated via `?token=` + # set a cookie for future requests + self.hub_auth.set_cookie(self, token) return self._hub_auth_user_cache