mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 05:53:00 +00:00
cache HubAuth user per request
This commit is contained in:
@@ -300,8 +300,12 @@ class HubAuthenticated(object):
|
|||||||
Returns:
|
Returns:
|
||||||
user_model (dict): The user model, if a user is identified, None if authentication fails.
|
user_model (dict): The user model, if a user is identified, None if authentication fails.
|
||||||
"""
|
"""
|
||||||
|
if hasattr(self, '_hub_auth_user_cache'):
|
||||||
|
return self._hub_auth_user_cache
|
||||||
user_model = self.hub_auth.get_user(self)
|
user_model = self.hub_auth.get_user(self)
|
||||||
if not user_model:
|
if not user_model:
|
||||||
|
self._hub_auth_user_cache = None
|
||||||
return
|
return
|
||||||
return self.check_hub_user(user_model)
|
self._hub_auth_user_cache = self.check_hub_user(user_model)
|
||||||
|
return self._hub_auth_user_cache
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user