diff --git a/gso/auth/api_key_auth.py b/gso/auth/api_key_auth.py index c3fb362998d9ac5ea96d73b65f0dbf0ff92f381e..1dc6bf9e143e23d45b1dc8bfe9f3d39310fb061e 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 7af29f351c6578a0fff9a64163514646b9dd8cce..a9a0aadd96a46133a30fe561b5af612ae1e762cf 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 fac1c16889c64a670d2669d769617c988750ba98..98a7efb5aaa4d141d82e17899422f24c732ff84d 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", }, }