From b61f9fe9b3cee572a68fd883ff7eae5b27e0c0b7 Mon Sep 17 00:00:00 2001 From: Nico Guevara <42900763+Tostti@users.noreply.github.com> Date: Mon, 17 Oct 2022 07:03:51 -0300 Subject: [PATCH] Fix logout from Wazuh when SAML is enabled (#4664) * change function to get the path programatically * Update changelog (cherry picked from commit c320b31a10e03498fbe24695187cb5f2ce5f5cc2) --- CHANGELOG.md | 1 + public/app.js | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3c87ba4a9..f715d32008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improved Agents Overview performance [#4363](https://github.com/wazuh/wazuh-kibana-app/pull/4363) - Fixed a bug where the Wazuh logo was used instead of the custom one [#4539](https://github.com/wazuh/wazuh-kibana-app/pull/4539) - Fixed rendering problems of the `Agent Overview` section in low resolutions [#4516](https://github.com/wazuh/wazuh-kibana-app/pull/4516) +- Fixed issue when logging out from Wazuh when SAML is enabled [#4595](https://github.com/wazuh/wazuh-kibana-app/issues/4595) ## Wazuh v4.3.8 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 4309 diff --git a/public/app.js b/public/app.js index 5509c868b0..39da7fc8e5 100644 --- a/public/app.js +++ b/public/app.js @@ -107,8 +107,6 @@ app.run(['$rootElement', function ($rootElement) { // Add plugin help links as extension to plugin platform help menu addHelpMenuToAppChrome(); - - const urlToLogout = getHttp().basePath.prepend('/logout'); // Bind deleteExistentToken on Log out component. $('.euiHeaderSectionItem__button, .euiHeaderSectionItemButton').on('mouseleave', function () { @@ -119,14 +117,14 @@ app.run(['$rootElement', function ($rootElement) { // x-pack $('a:contains(Log out)').on('click', function (event) { // Override href's behaviour and navigate programatically - // to '/logout' once the token has been deleted. + // to the logout path once the token has been deleted. event.preventDefault(); WzAuthentication.deleteExistentToken() .catch((err) => { console.error('[ERROR] - User token could not be deprecated - ', err); }) .finally(() => { - window.location = urlToLogout; + window.location = event.currentTarget.href; }); }); });