def authenticate(self, req: Request) -> Deferred: user = req.loggedInUser() if user is None: return succeed(SuperUser()) else: # Use logged-in user. return succeed(user)
def authenticate(self, req: Request) -> Deferred: user = req.loggedInUser() if user is not None: # User has already authenticated. return succeed(user) elif self.project.anonguest: return succeed(AnonGuestUser()) else: # User must log in. return fail(LoginFailed())