mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 15:25:29 +00:00
refac: id_token -> oauth_id_token
This commit is contained in:
parent
899424b371
commit
a3ca632921
@ -507,8 +507,8 @@ async def signout(request: Request, response: Response):
|
|||||||
response.delete_cookie("token")
|
response.delete_cookie("token")
|
||||||
|
|
||||||
if ENABLE_OAUTH_SIGNUP.value:
|
if ENABLE_OAUTH_SIGNUP.value:
|
||||||
id_token = request.cookies.get("id_token")
|
oauth_id_token = request.cookies.get("oauth_id_token")
|
||||||
if id_token:
|
if oauth_id_token:
|
||||||
try:
|
try:
|
||||||
async with ClientSession() as session:
|
async with ClientSession() as session:
|
||||||
async with session.get(OPENID_PROVIDER_URL.value) as resp:
|
async with session.get(OPENID_PROVIDER_URL.value) as resp:
|
||||||
@ -516,12 +516,14 @@ async def signout(request: Request, response: Response):
|
|||||||
openid_data = await resp.json()
|
openid_data = await resp.json()
|
||||||
logout_url = openid_data.get("end_session_endpoint")
|
logout_url = openid_data.get("end_session_endpoint")
|
||||||
if logout_url:
|
if logout_url:
|
||||||
response.delete_cookie("id_token")
|
response.delete_cookie("oauth_id_token")
|
||||||
return RedirectResponse(url=f"{logout_url}?id_token_hint={id_token}")
|
return RedirectResponse(
|
||||||
|
url=f"{logout_url}?id_token_hint={oauth_id_token}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=resp.status,
|
status_code=resp.status,
|
||||||
detail="Failed to fetch OpenID configuration"
|
detail="Failed to fetch OpenID configuration",
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
|
@ -254,10 +254,10 @@ class OAuthManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if ENABLE_OAUTH_SIGNUP.value:
|
if ENABLE_OAUTH_SIGNUP.value:
|
||||||
id_token = token.get("id_token")
|
oauth_id_token = token.get("id_token")
|
||||||
response.set_cookie(
|
response.set_cookie(
|
||||||
key="id_token",
|
key="oauth_id_token",
|
||||||
value=id_token,
|
value=oauth_id_token,
|
||||||
httponly=True,
|
httponly=True,
|
||||||
samesite=WEBUI_SESSION_COOKIE_SAME_SITE,
|
samesite=WEBUI_SESSION_COOKIE_SAME_SITE,
|
||||||
secure=WEBUI_SESSION_COOKIE_SECURE,
|
secure=WEBUI_SESSION_COOKIE_SECURE,
|
||||||
|
Loading…
Reference in New Issue
Block a user