Example #1
0
 def authenticate(self, auth_token, login, password_token):
     user = self.get_by('login', login)
     expected = sha256(auth_token + '\0' + user['password'])
     if expected == password_token:
         return self.get_by('login', login)
     else:
         logging.debug('authentication failed user: %r, token: %r, expected: %r, auth_token: %s', login, password_token, expected, auth_token)
         raise AuthenticationError()
Example #2
0
 def create_root(self):
     # create root with empty password
     self.create_user(login='******', mail='', password=sha256('\0'), salt='')