API Key 인증 완전 제거
사내 운영 전제로 X-API-Key 인증을 전면 제거. - app/core/auth.py 삭제 - routes.py에서 Depends(require_api_key) 모두 제거 - config.Settings에서 api_keys / api_key_set 제거 - .env / .env.example에서 API_KEYS 제거 - docker-compose.yml에서 API_KEYS 환경변수 제거 (KOSIMCSE_MODEL 추가) - UI(index.html)에서 DEFAULT_API_KEY 상수 + X-API-Key 헤더 모두 제거 - scripts/sample_curl.sh, sample_python.py에서 키 헤더 제거 - tests: test_detect_requires_api_key → test_detect_no_auth_required로 갱신 - README: 인증 컬럼 제거, curl 예시에서 헤더 제거
This commit is contained in:
1 parent
f31ef142e8
commit
4913bf3ecc
10 files changed
+27
-78
No files matched your search
@@ -1,13 +0,0 @@
|
||||
from fastapi import Header, HTTPException, status
|
||||
|
||||
from app.core.config import get_settings
|
||||
|
||||
|
||||
async def require_api_key(x_api_key: str | None = Header(default=None)) -> str:
|
||||
settings = get_settings()
|
||||
if not x_api_key or x_api_key not in settings.api_key_set:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Invalid or missing X-API-Key header",
|
||||
)
|
||||
return x_api_key
|
||||
@@ -13,7 +13,6 @@ class Settings(BaseSettings):
|
||||
log_level: str = "info" # debug / info / warning / error
|
||||
reload: bool = False # 개발용 자동 재시작
|
||||
|
||||
api_keys: str = "combooks-key-change-me,baikal-key-change-me"
|
||||
engine_version: str = "o2o-plagiarism-2.0.0-pdf-v1.2"
|
||||
reference_corpus_dir: str = "./data/reference"
|
||||
taxonomy_dir: str = "./data/taxonomy"
|
||||
@@ -49,10 +48,6 @@ class Settings(BaseSettings):
|
||||
autobiography_mode: bool = True
|
||||
enable_entity_masking: bool = True
|
||||
|
||||
@property
|
||||
def api_key_set(self) -> set[str]:
|
||||
return {k.strip() for k in self.api_keys.split(",") if k.strip()}
|
||||
|
||||
@property
|
||||
def corpus_path(self) -> Path:
|
||||
return Path(self.reference_corpus_dir).resolve()
|
||||
|
||||
Reference in new issue
Block a user