def authenticate(self, context, username, password): """ Login with specified username and password. @param username (str) @param password (str) @return (is_logged (bool), groups (list)) """ # first, try the primary auth system. If authentication fails, # try the secondary auth system, if any. logged, groups = SimpleAuth.authenticate(self, context, username, password) if logged: return logged, groups if self.secondary_auth and self.secondary_auth.authenticate(username, password): groups = self.secondary_auth.getGroups(username) if not groups: groups = self.primary_auth.getGroups(username) return True, groups self.try_emit(context, username) return False, []
def __init__(self, core): SimpleAuth.__init__(self, core) self.secondary_auth = None self.configureSecondaryAuth()