handle when auth token is not enabled
This commit is contained in:
parent
8d6b2ce49c
commit
84ea2f8891
|
@ -7,6 +7,10 @@ from llm_server import opts
|
||||||
|
|
||||||
|
|
||||||
def check_auth(token):
|
def check_auth(token):
|
||||||
|
if not opts.admin_token:
|
||||||
|
# The admin token is not set/enabled.
|
||||||
|
# Default: deny all.
|
||||||
|
return False
|
||||||
password = None
|
password = None
|
||||||
if token.startswith('Basic '):
|
if token.startswith('Basic '):
|
||||||
try:
|
try:
|
||||||
|
@ -17,7 +21,6 @@ def check_auth(token):
|
||||||
password = token.split('Bearer ', maxsplit=1)
|
password = token.split('Bearer ', maxsplit=1)
|
||||||
del password[0]
|
del password[0]
|
||||||
password = ''.join(password)
|
password = ''.join(password)
|
||||||
print(password, token)
|
|
||||||
return password == opts.admin_token
|
return password == opts.admin_token
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ redis~=5.0.0
|
||||||
gevent
|
gevent
|
||||||
async-timeout
|
async-timeout
|
||||||
flask-sock
|
flask-sock
|
||||||
auto_gptq
|
|
||||||
uvicorn~=0.23.2
|
uvicorn~=0.23.2
|
||||||
fastapi~=0.103.1
|
fastapi~=0.103.1
|
||||||
torch~=2.0.1
|
torch~=2.0.1
|
||||||
|
@ -17,6 +16,5 @@ urllib3~=2.0.4
|
||||||
PyMySQL~=1.1.0
|
PyMySQL~=1.1.0
|
||||||
DBUtils~=3.0.3
|
DBUtils~=3.0.3
|
||||||
simplejson~=3.19.1
|
simplejson~=3.19.1
|
||||||
setuptools~=65.5.1
|
|
||||||
websockets~=11.0.3
|
websockets~=11.0.3
|
||||||
basicauth~=1.0.0
|
basicauth~=1.0.0
|
Reference in New Issue