mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
PM-8113 - Fix SSO + 2FA result handling by closing proper popout window
This commit is contained in:
parent
97050d2d15
commit
b6c2abf86a
@ -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" });
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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<boolean> {
|
||||
|
Loading…
Reference in New Issue
Block a user