allow check_whitelist to be a coroutine

Some authenticators may have whitelist checking that requires
async operations.
This commit is contained in:
Joseph Weston
2016-11-21 16:13:50 +01:00
parent 9f134277a9
commit d244a1e02f

View File

@@ -132,7 +132,9 @@ class Authenticator(LoggingConfigurable):
if not self.validate_username(username): if not self.validate_username(username):
self.log.warning("Disallowing invalid username %r.", username) self.log.warning("Disallowing invalid username %r.", username)
return return
if self.check_whitelist(username):
whitelist_pass = yield gen.maybe_future(self.check_whitelist(username))
if whitelist_pass:
return username return username
else: else:
self.log.warning("User %r not in whitelist.", username) self.log.warning("User %r not in whitelist.", username)