aboutsummaryrefslogtreecommitdiff
path: root/api/util/check_api_key.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-11-04 00:12:36 -0600
committerParker <contact@pkrm.dev>2024-11-04 00:12:36 -0600
commit8ae8c5c454ba42e8f56f415d33bbaaac7d1a37ec (patch)
treed56704d87f63b79681530ab729d9f54d24f73c80 /api/util/check_api_key.py
parent65fef6274166678f59d6d81c9da68465a7c374bc (diff)
Remove API Keys -> Authenticate with JWT
Diffstat (limited to 'api/util/check_api_key.py')
-rw-r--r--api/util/check_api_key.py21
1 files changed, 0 insertions, 21 deletions
diff --git a/api/util/check_api_key.py b/api/util/check_api_key.py
deleted file mode 100644
index 9c4c22e..0000000
--- a/api/util/check_api_key.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from fastapi import Security, HTTPException, Depends, status
-from fastapi.security import APIKeyHeader
-
-from models import User
-from api.util.db_dependency import get_db
-
-"""
-Make sure the provided API key is valid, then return the user's ID
-"""
-api_key_header = APIKeyHeader(name="X-API-Key")
-
-
-def check_api_key(
- api_key_header: str = Security(api_key_header), db=Depends(get_db)
-) -> str:
- response = db.query(User).filter(User.api_key == api_key_header).first()
- if not response:
- raise HTTPException(
- status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid API key"
- )
- return {"value": api_key_header, "owner": response.id}