Skip to content

Commit 3b70fca

Browse files
committed
Remove basic authentication
1 parent 587dd17 commit 3b70fca

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

python/main.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
import pydicom
2727
import pytest
2828
import torch
29-
from dotenv import dotenv_values
30-
from fastapi import Body, Depends, FastAPI, HTTPException, Request, UploadFile, status
29+
from fastapi import Body, FastAPI, Request, UploadFile, status
3130
from fastapi.responses import HTMLResponse
32-
from fastapi.security import HTTPBasic, HTTPBasicCredentials
3331
from fastapi.staticfiles import StaticFiles
3432
from fastapi.templating import Jinja2Templates
3533
from fastapi.testclient import TestClient
@@ -191,18 +189,6 @@ def test_submit_button() -> None:
191189
)
192190

193191

194-
def authenticate(credentials: HTTPBasicCredentials = Depends(security)) -> bool: # noqa: B008
195-
correct_username = credentials.username == env_vars["USERNAME"]
196-
correct_password = credentials.password == env_vars["PASSWORD"]
197-
if not (correct_username and correct_password):
198-
raise HTTPException(
199-
status_code=status.HTTP_401_UNAUTHORIZED,
200-
detail="Incorrect username or password",
201-
headers={"WWW-Authenticate": "Basic"},
202-
)
203-
return True
204-
205-
206192
@app.get("/check_existence_of_clean")
207193
async def check_existence_of_clean() -> UploadFilesResponse:
208194
session_fp = "./tmp/session-data/clean/de-identified-files/session.json"
@@ -231,7 +217,7 @@ async def check_existence_of_clean() -> UploadFilesResponse:
231217
)
232218

233219

234-
@app.get("/", response_class=HTMLResponse, dependencies=[Depends(authenticate)])
220+
@app.get("/", response_class=HTMLResponse)
235221
async def get_root(request: Request) -> HTMLResponse:
236222
return templates.TemplateResponse("index.html", {"request": request})
237223

0 commit comments

Comments
 (0)