mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac: api key auth allowed paths
This commit is contained in:
parent
326514be4e
commit
a2366a20ba
1 changed files with 7 additions and 0 deletions
|
|
@ -95,6 +95,13 @@ def get_current_user(
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_NOT_ALLOWED
|
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_NOT_ALLOWED
|
||||||
)
|
)
|
||||||
|
|
||||||
|
allowed_paths = ["/api/models", "/api/chat/completions"]
|
||||||
|
if request.url.path not in allowed_paths:
|
||||||
|
raise HTTPException(
|
||||||
|
status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.API_KEY_NOT_ALLOWED
|
||||||
|
)
|
||||||
|
|
||||||
return get_current_user_by_api_key(token)
|
return get_current_user_by_api_key(token)
|
||||||
|
|
||||||
# auth by jwt token
|
# auth by jwt token
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue