Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def authenticate(self, handler):
username = yield GoogleOAuthenticator.authenticate(self, handler)
if not username or not username.endswith('@'+self.hosted_domain):
username = None
else:
username = username.split('@')[0]
if self.whitelist and username not in self.whitelist:
username = None
raise gen.Return(username)