|
26 | 26 | import pydicom
|
27 | 27 | import pytest
|
28 | 28 | 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 |
31 | 30 | from fastapi.responses import HTMLResponse
|
32 |
| -from fastapi.security import HTTPBasic, HTTPBasicCredentials |
33 | 31 | from fastapi.staticfiles import StaticFiles
|
34 | 32 | from fastapi.templating import Jinja2Templates
|
35 | 33 | from fastapi.testclient import TestClient
|
@@ -191,18 +189,6 @@ def test_submit_button() -> None:
|
191 | 189 | )
|
192 | 190 |
|
193 | 191 |
|
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 |
| - |
206 | 192 | @app.get("/check_existence_of_clean")
|
207 | 193 | async def check_existence_of_clean() -> UploadFilesResponse:
|
208 | 194 | session_fp = "./tmp/session-data/clean/de-identified-files/session.json"
|
@@ -231,7 +217,7 @@ async def check_existence_of_clean() -> UploadFilesResponse:
|
231 | 217 | )
|
232 | 218 |
|
233 | 219 |
|
234 |
| -@app.get("/", response_class=HTMLResponse, dependencies=[Depends(authenticate)]) |
| 220 | +@app.get("/", response_class=HTMLResponse) |
235 | 221 | async def get_root(request: Request) -> HTMLResponse:
|
236 | 222 | return templates.TemplateResponse("index.html", {"request": request})
|
237 | 223 |
|
|
0 commit comments