mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 20:43:02 +00:00
more debug logging for Hub auth
This commit is contained in:
@@ -174,6 +174,7 @@ class HubAuth(Configurable):
|
|||||||
raise HTTPError(500, msg)
|
raise HTTPError(500, msg)
|
||||||
|
|
||||||
if r.status_code == 404:
|
if r.status_code == 404:
|
||||||
|
app_log.warning("No Hub user identified for request")
|
||||||
data = None
|
data = None
|
||||||
elif r.status_code == 403:
|
elif r.status_code == 403:
|
||||||
app_log.error("I don't have permission to verify cookies, my auth token may have expired: [%i] %s", r.status_code, r.reason)
|
app_log.error("I don't have permission to verify cookies, my auth token may have expired: [%i] %s", r.status_code, r.reason)
|
||||||
@@ -186,6 +187,7 @@ class HubAuth(Configurable):
|
|||||||
raise HTTPError(500, "Failed to check authorization")
|
raise HTTPError(500, "Failed to check authorization")
|
||||||
else:
|
else:
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
app_log.debug("Received request from Hub user %s", data)
|
||||||
self.cookie_cache[encrypted_cookie] = data
|
self.cookie_cache[encrypted_cookie] = data
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@@ -274,14 +276,18 @@ class HubAuthenticated(object):
|
|||||||
Returns:
|
Returns:
|
||||||
user_model (dict): The user model if the user should be allowed, None otherwise.
|
user_model (dict): The user model if the user should be allowed, None otherwise.
|
||||||
"""
|
"""
|
||||||
|
name = user_model['name']
|
||||||
if self.hub_users is None and self.hub_groups is None:
|
if self.hub_users is None and self.hub_groups is None:
|
||||||
# no whitelist specified, allow any authenticated Hub user
|
# no whitelist specified, allow any authenticated Hub user
|
||||||
|
app_log.debug("Allowing Hub user %s (all Hub users allowed)", name)
|
||||||
return user_model
|
return user_model
|
||||||
name = user_model['name']
|
|
||||||
if self.hub_users and name in self.hub_users:
|
if self.hub_users and name in self.hub_users:
|
||||||
# user in whitelist
|
# user in whitelist
|
||||||
|
app_log.debug("Allowing whitelisted Hub user %s", name)
|
||||||
return user_model
|
return user_model
|
||||||
elif self.hub_groups and set(user_model['groups']).intersection(self.hub_groups):
|
elif self.hub_groups and set(user_model['groups']).intersection(self.hub_groups):
|
||||||
|
allowed_groups = set(user_model['groups']).intersection(self.hub_groups)
|
||||||
|
app_log.debug("Allowing Hub user %s in group(s) %s", name, ','.join(sorted(allowed_groups)))
|
||||||
# group in whitelist
|
# group in whitelist
|
||||||
return user_model
|
return user_model
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user