log out of oidc on galaxy logout

This commit is contained in:
Juleen Graham
2021-03-10 10:23:18 +01:00
committed by mvdbeek
parent 90e4f0c434
commit 30eacaa8a4
2 changed files with 18 additions and 1 deletions
+17 -1
View File
@@ -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;
@@ -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,