コード例 #1
0
ファイル: http.py プロジェクト: xzxiongda/supervisor
 def authorize(self, auth_info):
     username, password = auth_info
     if username in self.dict:
         stored_password = self.dict[username]
         if stored_password.startswith('{SHA}'):
             password_hash = sha1(as_bytes(password)).hexdigest()
             return stored_password[5:] == password_hash
         else:
             return stored_password == password
     else:
         return False
コード例 #2
0
 def authorize(self, auth_info):
     username, password = auth_info
     if username in self.dict:
         stored_password = self.dict[username]
         if stored_password.startswith('{SHA}'):
             password_hash = sha1(as_bytes(password)).hexdigest()
             return stored_password[5:] == password_hash
         else:
             return stored_password == password
     else:
         return False
コード例 #3
0
ファイル: test_http.py プロジェクト: zzlyzq/supervisor
 def test_authorize_gooduser_goodpassword_sha(self):
     password = '******' + sha1(as_bytes('password')).hexdigest()
     authorizer = self._makeOne({'foo': password})
     self.assertTrue(authorizer.authorize(('foo', 'password')))
コード例 #4
0
ファイル: test_http.py プロジェクト: ngocson2vn/supervisor
 def test_authorize_gooduser_goodpassword_sha(self):
     password = '******' + sha1(as_bytes('password')).hexdigest()
     authorizer = self._makeOne({'foo':password})
     self.assertTrue(authorizer.authorize(('foo', 'password')))