From d244a1e02fd6cf5f705e261f32e08a10c53572dd Mon Sep 17 00:00:00 2001 From: Joseph Weston Date: Mon, 21 Nov 2016 16:13:50 +0100 Subject: [PATCH] allow `check_whitelist` to be a coroutine Some authenticators may have whitelist checking that requires async operations. --- jupyterhub/auth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jupyterhub/auth.py b/jupyterhub/auth.py index 8ed982ee..a9f2620c 100644 --- a/jupyterhub/auth.py +++ b/jupyterhub/auth.py @@ -132,7 +132,9 @@ class Authenticator(LoggingConfigurable): if not self.validate_username(username): self.log.warning("Disallowing invalid username %r.", username) return - if self.check_whitelist(username): + + whitelist_pass = yield gen.maybe_future(self.check_whitelist(username)) + if whitelist_pass: return username else: self.log.warning("User %r not in whitelist.", username)