Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
8e52ba8b
Commit
8e52ba8b
authored
Mar 20, 2024
by
Timothy J. Baek
Browse files
refac: auth required for litellm in dev
parent
ed0d4b5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
backend/apps/litellm/main.py
backend/apps/litellm/main.py
+6
-7
No files found.
backend/apps/litellm/main.py
View file @
8e52ba8b
...
...
@@ -47,13 +47,12 @@ async def auth_middleware(request: Request, call_next):
auth_header
=
request
.
headers
.
get
(
"Authorization"
,
""
)
request
.
state
.
user
=
None
if
ENV
!=
"dev"
:
try
:
user
=
get_current_user
(
get_http_authorization_cred
(
auth_header
))
print
(
user
)
request
.
state
.
user
=
user
except
Exception
as
e
:
return
JSONResponse
(
status_code
=
400
,
content
=
{
"detail"
:
str
(
e
)})
try
:
user
=
get_current_user
(
get_http_authorization_cred
(
auth_header
))
print
(
user
)
request
.
state
.
user
=
user
except
Exception
as
e
:
return
JSONResponse
(
status_code
=
400
,
content
=
{
"detail"
:
str
(
e
)})
response
=
await
call_next
(
request
)
return
response
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment