from fastapi import APIRouter, HTTPException users = [] # In-memory storage router = APIRouter() @router.get("/auth") async def authenticate_user( username: str = "demo", password: str = "password" ): """authenticates the user with details""" if request.method != "GET": raise HTTPException(status_code=405, detail={ "message": "Method Not Allowed", "method": request.method, "_verb": "get" }) user = next((u for u in users if u["username"] == username), None) if not user or user["password"] != password: raise HTTPException(status_code=400, detail="Invalid credentials") return { "method": "GET", "message": "Authentication successful (demo)", "user": username, "token": "dummy_jwt_token_123", "features": { "rate_limit": 100, "expires_in": 3600 } }