From aa6813938a7da94721a8ecd84042db0a70c0a6aa Mon Sep 17 00:00:00 2001 From: Mohammad Torkashvand <mohammad.torkashvand@geant.org> Date: Wed, 24 Jan 2024 16:11:25 +0100 Subject: [PATCH] change key and value in THIRD_PARTY_API_KEYS dict --- gso/auth/api_key_auth.py | 2 +- gso/oss-params-example.json | 4 ++-- test/conftest.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gso/auth/api_key_auth.py b/gso/auth/api_key_auth.py index c3fb3629..1dc6bf9e 100644 --- a/gso/auth/api_key_auth.py +++ b/gso/auth/api_key_auth.py @@ -14,7 +14,7 @@ async def get_api_key(api_key: str = Depends(api_key_header)) -> str: settings = load_oss_params() # TODO: This is a simulated database of API keys which should be replace with a real one - if api_key in settings.THIRD_PARTY_API_KEYS: + if api_key in settings.THIRD_PARTY_API_KEYS.values(): return api_key raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Invalid API Key") diff --git a/gso/oss-params-example.json b/gso/oss-params-example.json index 7af29f35..a9a0aadd 100644 --- a/gso/oss-params-example.json +++ b/gso/oss-params-example.json @@ -75,7 +75,7 @@ "result_expires": 3600 }, "THIRD_PARTY_API_KEYS": { - "REALLY_random_AND_secure_T0keN": "Ansible Dynamic Inventory Generator", - "Another_REALLY_random_AND_secure_T0keN": "Application 2" + "Ansible Dynamic Inventory Generator": "REALLY_random_AND_secure_T0keN", + "Application 2": "another_REALY_random_AND_3cure_T0keN" } } diff --git a/test/conftest.py b/test/conftest.py index fac1c168..98a7efb5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -205,8 +205,8 @@ def configuration_data() -> dict: "result_expires": 3600, }, "THIRD_PARTY_API_KEYS": { - "REALY_random_AND_3cure_T0keN": "LSO", - "another_REALY_random_AND_3cure_T0keN": "Application 2", + "Ansible Dynamic Inventory Generator": "REALY_random_AND_3cure_T0keN", + "Application 2": "another_REALY_random_AND_3cure_T0keN", }, } -- GitLab