From 84ea2f889184cfb0287d59e1a17c1bf01e3a52e4 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 24 Sep 2023 15:57:39 -0600 Subject: [PATCH] handle when auth token is not enabled --- llm_server/routes/auth.py | 5 ++++- requirements.txt | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/llm_server/routes/auth.py b/llm_server/routes/auth.py index 680e3a2..58ce1c6 100644 --- a/llm_server/routes/auth.py +++ b/llm_server/routes/auth.py @@ -7,6 +7,10 @@ from llm_server import opts def check_auth(token): + if not opts.admin_token: + # The admin token is not set/enabled. + # Default: deny all. + return False password = None if token.startswith('Basic '): try: @@ -17,7 +21,6 @@ def check_auth(token): password = token.split('Bearer ', maxsplit=1) del password[0] password = ''.join(password) - print(password, token) return password == opts.admin_token diff --git a/requirements.txt b/requirements.txt index ed1f6de..f8e81eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,6 @@ redis~=5.0.0 gevent async-timeout flask-sock -auto_gptq uvicorn~=0.23.2 fastapi~=0.103.1 torch~=2.0.1 @@ -17,6 +16,5 @@ urllib3~=2.0.4 PyMySQL~=1.1.0 DBUtils~=3.0.3 simplejson~=3.19.1 -setuptools~=65.5.1 websockets~=11.0.3 basicauth~=1.0.0 \ No newline at end of file