Migrate request/response interceptors to FastAPI middleware - Created FastAPI-compatible auth and validation middleware

This commit is contained in:
2025-10-06 08:42:42 +02:00
parent e0c80c178d
commit 721326ecaf
4 changed files with 477 additions and 1 deletions

View File

@@ -34,6 +34,10 @@ from fastapi.templating import Jinja2Templates
from pydantic import BaseModel, Field
from pydantic_settings import BaseSettings
# Import our custom middleware
from web.middleware.fastapi_auth_middleware import AuthMiddleware
from web.middleware.fastapi_validation_middleware import ValidationMiddleware
# Configure logging
logging.basicConfig(
level=logging.INFO,
@@ -246,6 +250,10 @@ app.add_middleware(
allow_headers=["*"],
)
# Add custom middleware
app.add_middleware(AuthMiddleware)
app.add_middleware(ValidationMiddleware)
# Request logging middleware
@app.middleware("http")
async def log_requests(request: Request, call_next):