Skip to content
Snippets Groups Projects
Commit aa681393 authored by Mohammad Torkashvand's avatar Mohammad Torkashvand Committed by Neda Moeini
Browse files

change key and value in THIRD_PARTY_API_KEYS dict

parent 4939e5d2
No related branches found
No related tags found
1 merge request!149Add API key authentication for routes
...@@ -14,7 +14,7 @@ async def get_api_key(api_key: str = Depends(api_key_header)) -> str: ...@@ -14,7 +14,7 @@ async def get_api_key(api_key: str = Depends(api_key_header)) -> str:
settings = load_oss_params() settings = load_oss_params()
# TODO: This is a simulated database of API keys which should be replace with a real one # 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 return api_key
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Invalid API Key") raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Invalid API Key")
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
"result_expires": 3600 "result_expires": 3600
}, },
"THIRD_PARTY_API_KEYS": { "THIRD_PARTY_API_KEYS": {
"REALLY_random_AND_secure_T0keN": "Ansible Dynamic Inventory Generator", "Ansible Dynamic Inventory Generator": "REALLY_random_AND_secure_T0keN",
"Another_REALLY_random_AND_secure_T0keN": "Application 2" "Application 2": "another_REALY_random_AND_3cure_T0keN"
} }
} }
...@@ -205,8 +205,8 @@ def configuration_data() -> dict: ...@@ -205,8 +205,8 @@ def configuration_data() -> dict:
"result_expires": 3600, "result_expires": 3600,
}, },
"THIRD_PARTY_API_KEYS": { "THIRD_PARTY_API_KEYS": {
"REALY_random_AND_3cure_T0keN": "LSO", "Ansible Dynamic Inventory Generator": "REALY_random_AND_3cure_T0keN",
"another_REALY_random_AND_3cure_T0keN": "Application 2", "Application 2": "another_REALY_random_AND_3cure_T0keN",
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment