diff --git a/client/src/layout/menu.js b/client/src/layout/menu.js index a406641c896..3b698315cd6 100644 --- a/client/src/layout/menu.js +++ b/client/src/layout/menu.js @@ -1,6 +1,8 @@ import axios from "axios"; import { getGalaxyInstance } from "app"; import _l from "utils/localization"; +import { CommunicationServerView } from "layout/communication-server-view"; +import { getIdentityProviders } from "components/User/ExternalIdentities/service"; const POST_LOGOUT_URL = "root/login?is_logout_redirect=true"; @@ -12,6 +14,12 @@ export function userLogout(logoutAll = false) { const galaxy = getGalaxyInstance(); const session_csrf_token = galaxy.session_csrf_token; const url = `${galaxy.root}user/logout?session_csrf_token=${session_csrf_token}&logout_all=${logoutAll}`; + + var identities; + getIdentityProviders() + .then((results) => { + identities = results; + }); axios .get(url) .then((response) => { @@ -20,7 +28,15 @@ export function userLogout(logoutAll = false) { } // Check if we need to logout of OIDC IDP if (galaxy.config.enable_oidc) { - return axios.get(`${galaxy.root}authnz/logout`); + const email = galaxy.user.attributes.email; + var provider; + for (var i = 0; i < identities.length; i++) { + if (identities[i].email == email) { + provider = identities[i].provider; + break; + } + } + return axios.get(`${galaxy.root}authnz/${provider}/logout`); } else { // Otherwise pass through the initial logout response return response; diff --git a/lib/galaxy/webapps/galaxy/controllers/authnz.py b/lib/galaxy/webapps/galaxy/controllers/authnz.py index 2b07af637f8..eb39cb6a3c5 100644 --- a/lib/galaxy/webapps/galaxy/controllers/authnz.py +++ b/lib/galaxy/webapps/galaxy/controllers/authnz.py @@ -142,6 +142,7 @@ class OIDC(JSAppLauncher): return trans.response.send_redirect(redirect_url) @web.json + @web.expose def logout(self, trans, provider, **kwargs): post_logout_redirect_url = trans.request.base + url_for('/') + 'root/login?is_logout_redirect=true' success, message, redirect_uri = trans.app.authnz_manager.logout(provider,