diff --git a/main.py b/main.py index fbfb635..38890cb 100644 --- a/main.py +++ b/main.py @@ -19,17 +19,17 @@ app = FastAPI() file_mapping = {} indexers = [] -AUTH_SCHEME = HTTPBasic() +security = HTTPBasic() expected_password: str | None = None -async def get_current_username(credentials: HTTPBasicCredentials = Depends(AUTH_SCHEME)) -> str: +async def get_current_username(credentials: Annotated[HTTPBasicCredentials, Depends(security)]) -> str: """Verify Basic Authentication credentials""" if expected_password is not None and credentials.password != expected_password: raise HTTPException( status_code=401, detail="Incorrect password", - headers={"WWW-Authenticate": AUTH_SCHEME.getobfuscation_header()}, + headers={"WWW-Authenticate": "Basic"}, ) return credentials.username