File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -469,6 +469,12 @@ def __getattr__(self, key):
469469 os .environ .get ("OPENID_PROVIDER_URL" , "" ),
470470)
471471
472+ OPENID_END_SESSION_ENDPOINT = PersistentConfig (
473+ "OPENID_END_SESSION_ENDPOINT" ,
474+ "oauth.oidc.end_session_endpoint" ,
475+ os .environ .get ("OPENID_END_SESSION_ENDPOINT" , "" ),
476+ )
477+
472478OPENID_REDIRECT_URI = PersistentConfig (
473479 "OPENID_REDIRECT_URI" ,
474480 "oauth.oidc.redirect_uri" ,
@@ -844,13 +850,14 @@ def feishu_oauth_register(oauth: OAuth):
844850 if FEISHU_CLIENT_ID .value :
845851 configured_providers .append ("Feishu" )
846852
847- if configured_providers and not OPENID_PROVIDER_URL .value :
853+ if configured_providers and not OPENID_PROVIDER_URL .value and not OPENID_END_SESSION_ENDPOINT . value :
848854 provider_list = ", " .join (configured_providers )
849855 log .warning (
850856 f"⚠️ OAuth providers configured ({ provider_list } ) but OPENID_PROVIDER_URL not set - logout will not work!"
851857 )
852858 log .warning (
853- f"Set OPENID_PROVIDER_URL to your OAuth provider's OpenID Connect discovery endpoint to fix logout functionality."
859+ f"Set OPENID_PROVIDER_URL to your OAuth provider's OpenID Connect discovery endpoint,"
860+ f" or set OPENID_END_SESSION_ENDPOINT to a custom logout URL to fix logout functionality."
854861 )
855862
856863
Original file line number Diff line number Diff line change 4646from fastapi .responses import RedirectResponse , Response , JSONResponse
4747from open_webui .config import (
4848 OPENID_PROVIDER_URL ,
49+ OPENID_END_SESSION_ENDPOINT ,
4950 ENABLE_OAUTH_SIGNUP ,
5051 ENABLE_LDAP ,
5152 ENABLE_PASSWORD_AUTH ,
@@ -824,6 +825,19 @@ async def signout(
824825 response .delete_cookie ("oauth_session_id" )
825826
826827 session = OAuthSessions .get_session_by_id (oauth_session_id , db = db )
828+
829+ # If a custom end_session_endpoint is configured (e.g. AWS Cognito), redirect
830+ # there directly instead of attempting OIDC discovery.
831+ if OPENID_END_SESSION_ENDPOINT .value :
832+ return JSONResponse (
833+ status_code = 200 ,
834+ content = {
835+ "status" : True ,
836+ "redirect_url" : OPENID_END_SESSION_ENDPOINT .value ,
837+ },
838+ headers = response .headers ,
839+ )
840+
827841 oauth_server_metadata_url = (
828842 request .app .state .oauth_manager .get_server_metadata_url (session .provider )
829843 if session
You can’t perform that action at this time.
0 commit comments