|
@@ -31,7 +31,7 @@ from open_webui.env import (
|
|
SRC_LOG_LEVELS,
|
|
SRC_LOG_LEVELS,
|
|
)
|
|
)
|
|
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
|
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
|
-from fastapi.responses import RedirectResponse, Response
|
|
|
|
|
|
+from fastapi.responses import RedirectResponse, Response, JSONResponse
|
|
from open_webui.config import OPENID_PROVIDER_URL, ENABLE_OAUTH_SIGNUP, ENABLE_LDAP
|
|
from open_webui.config import OPENID_PROVIDER_URL, ENABLE_OAUTH_SIGNUP, ENABLE_LDAP
|
|
from pydantic import BaseModel
|
|
from pydantic import BaseModel
|
|
|
|
|
|
@@ -577,9 +577,14 @@ async def signout(request: Request, response: Response):
|
|
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("oauth_id_token")
|
|
response.delete_cookie("oauth_id_token")
|
|
- return RedirectResponse(
|
|
|
|
|
|
+
|
|
|
|
+ return JSONResponse(
|
|
|
|
+ status_code=200,
|
|
|
|
+ content={
|
|
|
|
+ "status": True,
|
|
|
|
+ "redirect_url": f"{logout_url}?id_token_hint={oauth_id_token}",
|
|
|
|
+ },
|
|
headers=response.headers,
|
|
headers=response.headers,
|
|
- url=f"{logout_url}?id_token_hint={oauth_id_token}",
|
|
|
|
)
|
|
)
|
|
else:
|
|
else:
|
|
raise HTTPException(
|
|
raise HTTPException(
|
|
@@ -594,12 +599,18 @@ async def signout(request: Request, response: Response):
|
|
)
|
|
)
|
|
|
|
|
|
if WEBUI_AUTH_SIGNOUT_REDIRECT_URL:
|
|
if WEBUI_AUTH_SIGNOUT_REDIRECT_URL:
|
|
- return RedirectResponse(
|
|
|
|
|
|
+ return JSONResponse(
|
|
|
|
+ status_code=200,
|
|
|
|
+ content={
|
|
|
|
+ "status": True,
|
|
|
|
+ "redirect_url": WEBUI_AUTH_SIGNOUT_REDIRECT_URL,
|
|
|
|
+ },
|
|
headers=response.headers,
|
|
headers=response.headers,
|
|
- url=WEBUI_AUTH_SIGNOUT_REDIRECT_URL,
|
|
|
|
)
|
|
)
|
|
|
|
|
|
- return {"status": True}
|
|
|
|
|
|
+ return JSONResponse(
|
|
|
|
+ status_code=200, content={"status": True}, headers=response.headers
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
############################
|
|
############################
|