Skip to content

Commit

Permalink
Check for "allowed_users" or "whitelist".
Browse files Browse the repository at this point in the history
Check for "allowed_users" or "whitelist".
The attribute controlling which users are allowed has changed in newer
versions of JupyterHub from "whitelist" to "allowed_users".
  • Loading branch information
cwaldbieser committed Mar 17, 2023
1 parent 3bc0c0c commit ffe254d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions jhub_cas_authenticator/cas_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ async def get(self):
app_log.debug("Attribute {0}: {1}".format(a, v))
raise web.HTTPError(401)

# Check against whitelist
whitelist = self.authenticator.whitelist
if whitelist and user not in whitelist:
app_log.debug("User not in whitelist: {0}".format(user))
# Check against allow list
allow_list = None
if hasattr(self.authenticator, "allowed_users"):
allow_list = self.authenticator.allowed_users
elif hasattr(self.authenticator, "whitelist"):
allow_list = self.authenticator.whitelist
if allow_list and user not in allow_list:
app_log.debug("User not in allow_list: {0}".format(user))
raise web.HTTPError(401)

# Success! Log user in.
Expand Down

0 comments on commit ffe254d

Please sign in to comment.