-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from equinor/refactor/change-python-jose-to-p…
…yjwt refactor: replace python-jose with pyjwt
- Loading branch information
Showing
8 changed files
with
57 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,14 +43,13 @@ class Config(BaseSettings): | |
raise ValueError("Authentication was enabled, but some auth configuration parameters are missing") | ||
|
||
if not config.AUTH_ENABLED: | ||
print("\n") | ||
print("################ WARNING ################") | ||
print("# Authentication is disabled #") | ||
print("################ WARNING ################\n") | ||
|
||
default_user: User = User( | ||
**{ | ||
"user_id": "nologin", | ||
"full_name": "Not Authenticated", | ||
"email": "[email protected]", | ||
} | ||
user_id="nologin", | ||
full_name="Not Authenticated", | ||
email="[email protected]", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
from starlette.status import HTTP_200_OK | ||
from starlette.testclient import TestClient | ||
|
||
from authentication.mock_token_generator import generate_mock_token | ||
from authentication.models import User | ||
from config import config | ||
from tests.integration.mock_authentication import get_mock_jwt_token | ||
|
||
pytestmark = pytest.mark.integration | ||
|
||
|
@@ -14,7 +14,7 @@ def test_whoami(self, test_app: TestClient): | |
config.AUTH_ENABLED = True | ||
config.TEST_TOKEN = True | ||
user = User(user_id="1", email="[email protected]", roles=["a"]) | ||
headers = {"Authorization": f"Bearer {generate_mock_token(user)}"} | ||
headers = {"Authorization": f"Bearer {get_mock_jwt_token(user)}"} | ||
response = test_app.get("/whoami", headers=headers) | ||
data = response.json() | ||
assert response.status_code == HTTP_200_OK | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters