Skip to content

Commit f302ca0

Browse files
committed
Remove middleware for protecting documentation endpoints
1 parent 3263926 commit f302ca0

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

backend/app/main.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from starlette.responses import JSONResponse
66
from datetime import datetime
77
from . import models, schemas, crud, database, security
8-
from fastapi import Request
98

109
app = FastAPI(title="MathCodeLab Certificate Verification API")
1110
models.Base.metadata.create_all(bind=database.engine)
@@ -20,14 +19,6 @@
2019
allow_headers=["*"],
2120
)
2221

23-
@app.middleware("http")
24-
async def protect_docs(request: Request, call_next):
25-
if request.url.path.startswith("/docs") or request.url.path.startswith("/openapi"):
26-
auth = request.headers.get("authorization")
27-
if auth != f"Bearer {os.getenv('ADMIN_API_KEY')}":
28-
return JSONResponse(status_code=401, content={"detail": "Unauthorized"})
29-
return await call_next(request)
30-
3122
@app.get("/")
3223
def root():
3324
return {

0 commit comments

Comments
 (0)