1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-18 10:23:52 +00:00

[PM-26901] Add notification handler for auto confirm (#18886)

* add notification handler for auto confirm

* add missing state check

* fix test

* isolate angular specific code from shared lib code

* clean up

* use autoconfirm method

* fix test
This commit is contained in:
Brandon Treston
2026-02-13 14:36:11 -05:00
committed by GitHub
parent 10a20a43a3
commit 2912bf05e1
25 changed files with 257 additions and 52 deletions

View File

@@ -14,7 +14,14 @@ import {
timeout,
} from "rxjs";
import { CollectionService, DefaultCollectionService } from "@bitwarden/admin-console/common";
import {
CollectionService,
DefaultCollectionService,
DefaultOrganizationUserApiService,
DefaultOrganizationUserService,
OrganizationUserApiService,
OrganizationUserService,
} from "@bitwarden/admin-console/common";
import {
AuthRequestApiServiceAbstraction,
AuthRequestService,
@@ -27,6 +34,10 @@ import {
LogoutReason,
UserDecryptionOptionsService,
} from "@bitwarden/auth/common";
import {
AutomaticUserConfirmationService,
DefaultAutomaticUserConfirmationService,
} from "@bitwarden/auto-confirm";
import { ApiService as ApiServiceAbstraction } from "@bitwarden/common/abstractions/api.service";
import { AuditService as AuditServiceAbstraction } from "@bitwarden/common/abstractions/audit.service";
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
@@ -487,6 +498,9 @@ export default class MainBackground {
onUpdatedRan: boolean;
onReplacedRan: boolean;
loginToAutoFill: CipherView = null;
organizationUserService: OrganizationUserService;
organizationUserApiService: OrganizationUserApiService;
autoConfirmService: AutomaticUserConfirmationService;
private commandsBackground: CommandsBackground;
private contextMenusBackground: ContextMenusBackground;
@@ -763,6 +777,15 @@ export default class MainBackground {
{ createRequest: (url, request) => new Request(url, request) },
);
this.organizationUserApiService = new DefaultOrganizationUserApiService(this.apiService);
this.organizationUserService = new DefaultOrganizationUserService(
this.keyService,
this.encryptService,
this.organizationUserApiService,
this.accountService,
this.i18nService,
);
this.hibpApiService = new HibpApiService(this.apiService);
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
this.cipherFileUploadService = new CipherFileUploadService(
@@ -804,6 +827,16 @@ export default class MainBackground {
this.authService,
);
this.autoConfirmService = new DefaultAutomaticUserConfirmationService(
this.configService,
this.apiService,
this.organizationUserService,
this.stateProvider,
this.organizationService,
this.organizationUserApiService,
this.policyService,
);
const sdkClientFactory = flagEnabled("sdk")
? new DefaultSdkClientFactory()
: new NoopSdkClientFactory();
@@ -1219,6 +1252,7 @@ export default class MainBackground {
this.authRequestAnsweringService,
this.configService,
this.policyService,
this.autoConfirmService,
);
this.fido2UserInterfaceService = new BrowserFido2UserInterfaceService(this.authService);

View File

@@ -42,7 +42,7 @@ import {
TwoFactorAuthComponent,
TwoFactorAuthGuard,
} from "@bitwarden/auth/angular";
import { canAccessAutoConfirmSettings } from "@bitwarden/auto-confirm";
import { canAccessAutoConfirmSettings } from "@bitwarden/auto-confirm/angular";
import { AnonLayoutWrapperComponent, AnonLayoutWrapperData } from "@bitwarden/components";
import {
LockComponent,

View File

@@ -12,7 +12,7 @@ import { NudgeType, NudgesService } from "@bitwarden/angular/vault";
import {
AutoConfirmExtensionSetupDialogComponent,
AutomaticUserConfirmationService,
} from "@bitwarden/auto-confirm";
} from "@bitwarden/auto-confirm/angular";
import { CurrentAccountComponent } from "@bitwarden/browser/auth/popup/account-switching/current-account.component";
import AutofillService from "@bitwarden/browser/autofill/services/autofill.service";
import { PopOutComponent } from "@bitwarden/browser/platform/popup/components/pop-out.component";

View File

@@ -28,7 +28,7 @@ import {
AutoConfirmExtensionSetupDialogComponent,
AutoConfirmState,
AutomaticUserConfirmationService,
} from "@bitwarden/auto-confirm";
} from "@bitwarden/auto-confirm/angular";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";

View File

@@ -16,7 +16,7 @@ import { SpotlightComponent } from "@bitwarden/angular/vault/components/spotligh
import {
AutoConfirmWarningDialogComponent,
AutomaticUserConfirmationService,
} from "@bitwarden/auto-confirm";
} from "@bitwarden/auto-confirm/angular";
import { PopOutComponent } from "@bitwarden/browser/platform/popup/components/pop-out.component";
import { PopupHeaderComponent } from "@bitwarden/browser/platform/popup/layout/popup-header.component";
import { PopupPageComponent } from "@bitwarden/browser/platform/popup/layout/popup-page.component";