diff --git a/apps/browser/src/auth/popup/utils/auth-popout-window.spec.ts b/apps/browser/src/auth/popup/utils/auth-popout-window.spec.ts index 9e7d69fad9..4e58b83214 100644 --- a/apps/browser/src/auth/popup/utils/auth-popout-window.spec.ts +++ b/apps/browser/src/auth/popup/utils/auth-popout-window.spec.ts @@ -9,6 +9,7 @@ import { openSsoAuthResultPopout, openTwoFactorAuthPopout, closeTwoFactorAuthPopout, + closeSsoAuthResultPopout, } from "./auth-popout-window"; describe("AuthPopoutWindow", () => { @@ -97,6 +98,14 @@ describe("AuthPopoutWindow", () => { }); }); + describe("closeSsoAuthResultPopout", () => { + it("closes the SSO authentication result popout window", async () => { + await closeSsoAuthResultPopout(); + + expect(closeSingleActionPopoutSpy).toHaveBeenCalledWith(AuthPopoutType.ssoAuthResult); + }); + }); + describe("openTwoFactorAuthPopout", () => { it("opens a window that facilitates two factor authentication", async () => { await openTwoFactorAuthPopout({ data: "data", remember: "remember" }); diff --git a/apps/browser/src/auth/popup/utils/auth-popout-window.ts b/apps/browser/src/auth/popup/utils/auth-popout-window.ts index 5a0e577807..9556a87806 100644 --- a/apps/browser/src/auth/popup/utils/auth-popout-window.ts +++ b/apps/browser/src/auth/popup/utils/auth-popout-window.ts @@ -82,11 +82,19 @@ async function closeTwoFactorAuthPopout() { await BrowserPopupUtils.closeSingleActionPopout(AuthPopoutType.twoFactorAuth); } +/** + * Closes the two-factor authentication popout window. + */ +async function closeSsoAuthResultPopout() { + await BrowserPopupUtils.closeSingleActionPopout(AuthPopoutType.ssoAuthResult); +} + export { AuthPopoutType, openUnlockPopout, closeUnlockPopout, openSsoAuthResultPopout, + closeSsoAuthResultPopout, openTwoFactorAuthPopout, closeTwoFactorAuthPopout, }; diff --git a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts index 9faa845ad4..d3fc6143ea 100644 --- a/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts +++ b/apps/browser/src/auth/services/extension-two-factor-auth-component.service.ts @@ -5,7 +5,7 @@ import { import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; import { BrowserApi } from "../../platform/browser/browser-api"; -import { closeTwoFactorAuthPopout } from "../popup/utils/auth-popout-window"; +import { closeSsoAuthResultPopout } from "../popup/utils/auth-popout-window"; export class ExtensionTwoFactorAuthComponentService extends DefaultTwoFactorAuthComponentService @@ -46,7 +46,7 @@ export class ExtensionTwoFactorAuthComponentService // We don't want the user to be left with a floating, popped out extension which could be lost behind // another window or minimized. Currently, the popped out window thinks it is active and wouldn't time out // which leads to the security concern. So, we close the popped out extension to avoid this. - await closeTwoFactorAuthPopout(); + await closeSsoAuthResultPopout(); } private async isLinux(): Promise {