def login(): id = request.json['id'] password = request.json['password'] if iam.authenticate(id, password): return { 'token': tokenutils.generate_auth_token(token_secret, id, 3600) } else: return create_error(401, 'Invalid username or password')
def test_create_user(self): created = iam.create('user', 'password') self.assertTrue(created) authenticated = iam.authenticate('user', 'password') self.assertTrue(authenticated)
def test_authenticate_bad_creds(self): authenticated = iam.authenticate('admin', 'wrong_pw') self.assertFalse(authenticated)
def test_authenticate(self): authenticated = iam.authenticate('admin', 'secret') self.assertTrue(authenticated)