mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
add timestamp on token cookie
This commit is contained in:
parent
860d8a8442
commit
4f2c6640d5
1 changed files with 7 additions and 7 deletions
|
@ -7372,6 +7372,8 @@ async def login(request: Request): # noqa: PLR0915
|
||||||
import multipart
|
import multipart
|
||||||
except ImportError:
|
except ImportError:
|
||||||
subprocess.run(["pip", "install", "python-multipart"])
|
subprocess.run(["pip", "install", "python-multipart"])
|
||||||
|
from litellm.proxy.management_helpers.ui_session_handler import UISessionHandler
|
||||||
|
|
||||||
global master_key
|
global master_key
|
||||||
if master_key is None:
|
if master_key is None:
|
||||||
raise ProxyException(
|
raise ProxyException(
|
||||||
|
@ -7489,9 +7491,9 @@ async def login(request: Request): # noqa: PLR0915
|
||||||
algorithm="HS256",
|
algorithm="HS256",
|
||||||
)
|
)
|
||||||
litellm_dashboard_ui += "?userID=" + user_id
|
litellm_dashboard_ui += "?userID=" + user_id
|
||||||
redirect_response = RedirectResponse(url=litellm_dashboard_ui, status_code=303)
|
return UISessionHandler.generate_authenticated_redirect_response(
|
||||||
redirect_response.set_cookie(key="token", value=jwt_token)
|
redirect_url=litellm_dashboard_ui, jwt_token=jwt_token
|
||||||
return redirect_response
|
)
|
||||||
elif _user_row is not None:
|
elif _user_row is not None:
|
||||||
"""
|
"""
|
||||||
When sharing invite links
|
When sharing invite links
|
||||||
|
@ -7557,11 +7559,9 @@ async def login(request: Request): # noqa: PLR0915
|
||||||
algorithm="HS256",
|
algorithm="HS256",
|
||||||
)
|
)
|
||||||
litellm_dashboard_ui += "?userID=" + user_id
|
litellm_dashboard_ui += "?userID=" + user_id
|
||||||
redirect_response = RedirectResponse(
|
return UISessionHandler.generate_authenticated_redirect_response(
|
||||||
url=litellm_dashboard_ui, status_code=303
|
redirect_url=litellm_dashboard_ui, jwt_token=jwt_token
|
||||||
)
|
)
|
||||||
redirect_response.set_cookie(key="token", value=jwt_token)
|
|
||||||
return redirect_response
|
|
||||||
else:
|
else:
|
||||||
raise ProxyException(
|
raise ProxyException(
|
||||||
message=f"Invalid credentials used to access UI.\nNot valid credentials for {username}",
|
message=f"Invalid credentials used to access UI.\nNot valid credentials for {username}",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue