feat(auth): add AuthMiddleware with JWT parsing and in-memory rate limiting; wire into app; add tests and docs
This commit is contained in:
@@ -26,6 +26,7 @@ from src.server.controllers.error_controller import (
|
||||
# Import controllers
|
||||
from src.server.controllers.health_controller import router as health_router
|
||||
from src.server.controllers.page_controller import router as page_router
|
||||
from src.server.middleware.auth import AuthMiddleware
|
||||
|
||||
# Initialize FastAPI app
|
||||
app = FastAPI(
|
||||
@@ -49,6 +50,9 @@ app.add_middleware(
|
||||
STATIC_DIR = Path(__file__).parent / "web" / "static"
|
||||
app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
|
||||
|
||||
# Attach authentication middleware (token parsing + simple rate limiter)
|
||||
app.add_middleware(AuthMiddleware, rate_limit_per_minute=5)
|
||||
|
||||
# Include routers
|
||||
app.include_router(health_router)
|
||||
app.include_router(page_router)
|
||||
|
||||
Reference in New Issue
Block a user