feat: #20 add email in JWT claims
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# this a test password storage with password in clear
|
||||
# need to be updated in the future to encrypt or hash the password
|
||||
# <username>:<password>
|
||||
toto:tata
|
||||
# <email>:<password>
|
||||
toto@toto.fr:tata
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestResponse(TestCase):
|
||||
|
||||
def test_get_target(self, pubkey=None):
|
||||
resp = requests.post(
|
||||
URL + "/get/", json={"username": "toto", "password": "tata"}
|
||||
URL + "/get/", json={"email": "toto@toto.fr", "password": "tata"}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200, "bad status code returned")
|
||||
self.assertIsNotNone(resp.json(), "response data can't be empty")
|
||||
@@ -34,6 +34,7 @@ class TestResponse(TestCase):
|
||||
},
|
||||
)
|
||||
self.assertEqual("thegux.fr", jwt_decoded["iss"])
|
||||
self.assertEqual("toto@toto.fr", jwt_decoded["email"])
|
||||
|
||||
jwt_exp = datetime.fromtimestamp(jwt_decoded["exp"])
|
||||
jwt_iat = datetime.fromtimestamp(jwt_decoded["iat"])
|
||||
@@ -43,7 +44,7 @@ class TestResponse(TestCase):
|
||||
|
||||
def test_validate_target_no_token(self):
|
||||
resp = requests.post(
|
||||
URL + "/validate/", json={"username": "toto", "password": "tata"}
|
||||
URL + "/validate/", json={"username": "toto@toto.fr", "password": "tata"}
|
||||
)
|
||||
self.assertEqual(resp.status_code, 200, "bad status code returned")
|
||||
self.assertIsNotNone(resp.json(), "response data can't be empty")
|
||||
@@ -92,9 +93,7 @@ class TestResponse(TestCase):
|
||||
)
|
||||
|
||||
def test_bad_credentials(self):
|
||||
resp = requests.post(
|
||||
URL + "/get/", json={"username": "tutu", "password": "titi"}
|
||||
)
|
||||
resp = requests.post(URL + "/get/", json={"email": "tutu", "password": "titi"})
|
||||
self.assertEqual(resp.status_code, 403, "bad status code returned")
|
||||
self.assertIsNotNone(resp.json(), "response data must not be empty")
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user