diff --git a/public/apps/account/log-out-button.tsx b/public/apps/account/log-out-button.tsx
index a3c76bfa0..500f4bdbd 100644
--- a/public/apps/account/log-out-button.tsx
+++ b/public/apps/account/log-out-button.tsx
@@ -16,7 +16,7 @@
import React from 'react';
import { EuiButtonEmpty } from '@elastic/eui';
import { HttpStart } from 'opensearch-dashboards/public';
-import { logout } from './utils';
+import { logout, samlLogout } from './utils';
export function LogoutButton(props: {
authType: string;
@@ -24,12 +24,12 @@ export function LogoutButton(props: {
divider: JSX.Element;
logoutUrl?: string;
}) {
- if (props.authType === 'openid' || props.authType === 'saml') {
+ if (props.authType === 'openid') {
return (
{props.divider}
);
+ } else if (props.authType === 'saml') {
+ return (
+
+ {props.divider}
+ samlLogout(props.http)}
+ >
+ Log out
+
+
+ );
} else if (props.authType === 'proxy') {
return ;
} else {
@@ -45,7 +59,7 @@ export function LogoutButton(props: {
{props.divider}
logout(props.http, props.logoutUrl)}
diff --git a/public/apps/account/test/__snapshots__/log-out-button.test.tsx.snap b/public/apps/account/test/__snapshots__/log-out-button.test.tsx.snap
index abdbbdc84..c3c476b25 100644
--- a/public/apps/account/test/__snapshots__/log-out-button.test.tsx.snap
+++ b/public/apps/account/test/__snapshots__/log-out-button.test.tsx.snap
@@ -4,7 +4,7 @@ exports[`Account menu - Log out button renders renders when auth type is OpenId
@@ -20,7 +20,7 @@ exports[`Account menu - Log out button renders renders when auth type is SAML 1`
Log out
@@ -32,7 +32,7 @@ exports[`Account menu - Log out button renders renders when auth type is not Ope
diff --git a/public/apps/account/test/log-out-button.test.tsx b/public/apps/account/test/log-out-button.test.tsx
index 6021cbad9..e8874c5ba 100644
--- a/public/apps/account/test/log-out-button.test.tsx
+++ b/public/apps/account/test/log-out-button.test.tsx
@@ -68,7 +68,7 @@ describe('Account menu - Log out button', () => {
const component = shallow(
);
- component.find('[data-test-subj="log-out-2"]').simulate('click');
+ component.find('[data-test-subj="log-out-3"]').simulate('click');
expect(logout).toBeCalled();
});
diff --git a/public/apps/account/utils.tsx b/public/apps/account/utils.tsx
index 5c0d8d485..b65daee58 100644
--- a/public/apps/account/utils.tsx
+++ b/public/apps/account/utils.tsx
@@ -38,6 +38,12 @@ export async function logout(http: HttpStart, logoutUrl?: string): Promise
logoutUrl || `${http.basePath.serverBasePath}/app/login?nextUrl=${nextUrl}`;
}
+export async function samlLogout(http: HttpStart): Promise {
+ // This will ensure tenancy is picked up from local storage in the next login.
+ setShouldShowTenantPopup(null);
+ window.location.href = `${http.basePath.serverBasePath}${API_AUTH_LOGOUT}`;
+}
+
export async function updateNewPassword(
http: HttpStart,
newPassword: string,