mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 00:09:04 +00:00
Hash JWT token in API
This commit is contained in:
@@ -4,6 +4,7 @@ import sys
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
import hashlib
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
@@ -48,6 +49,12 @@ def client(monkeypatch):
|
||||
return client, token
|
||||
|
||||
|
||||
def test_token_hashed(client):
|
||||
_, token = client
|
||||
assert api._token != token
|
||||
assert api._token == hashlib.sha256(token.encode()).hexdigest()
|
||||
|
||||
|
||||
def test_cors_and_auth(client):
|
||||
cl, token = client
|
||||
headers = {"Authorization": f"Bearer {token}", "Origin": "http://example.com"}
|
||||
|
Reference in New Issue
Block a user