ADK-gateway/backend/app/services/security.py
2026-08-04 17:20:08 +08:00

11 lines
340 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""认证校验CLI / Agent 请求必须携带与 GATEWAY_AUTH 一致的密码。"""
from fastapi import HTTPException
from app.config import settings
def require_auth(auth: str) -> None:
"""auth 不匹配时抛出 401。"""
if auth != settings.gateway_auth:
raise HTTPException(status_code=401, detail="invalid auth")