Beispiel #1
0
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')
Beispiel #2
0
 def test_create_user(self):
     created = iam.create('user', 'password')
     self.assertTrue(created)
     authenticated = iam.authenticate('user', 'password')
     self.assertTrue(authenticated)
Beispiel #3
0
 def test_authenticate_bad_creds(self):
     authenticated = iam.authenticate('admin', 'wrong_pw')
     self.assertFalse(authenticated)
Beispiel #4
0
 def test_authenticate(self):
     authenticated = iam.authenticate('admin', 'secret')
     self.assertTrue(authenticated)
Beispiel #5
0
 def test_create_user(self):
     created = iam.create('user', 'password')
     self.assertTrue(created)
     authenticated = iam.authenticate('user', 'password')
     self.assertTrue(authenticated)
Beispiel #6
0
 def test_authenticate_bad_creds(self):
     authenticated = iam.authenticate('admin', 'wrong_pw')
     self.assertFalse(authenticated)
Beispiel #7
0
 def test_authenticate(self):
     authenticated = iam.authenticate('admin', 'secret')
     self.assertTrue(authenticated)