mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
chore(flag-removal): [Auth/PM20439] Remove flagging logic and flag (BrowserExtensionLoginApproval) (#16568)
This commit is contained in:
@@ -102,7 +102,7 @@
|
|||||||
</bit-card>
|
</bit-card>
|
||||||
</bit-section>
|
</bit-section>
|
||||||
|
|
||||||
<bit-section *ngIf="extensionLoginApprovalFlagEnabled">
|
<bit-section>
|
||||||
<bit-section-header>
|
<bit-section-header>
|
||||||
<h2 bitTypography="h6">{{ "manageDevices" | i18n }}</h2>
|
<h2 bitTypography="h6">{{ "manageDevices" | i18n }}</h2>
|
||||||
</bit-section-header>
|
</bit-section-header>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
||||||
import { By } from "@angular/platform-browser";
|
import { By } from "@angular/platform-browser";
|
||||||
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { mock } from "jest-mock-extended";
|
import { mock } from "jest-mock-extended";
|
||||||
import { firstValueFrom, of } from "rxjs";
|
import { firstValueFrom, of } from "rxjs";
|
||||||
|
|
||||||
@@ -19,7 +20,6 @@ import {
|
|||||||
VaultTimeoutStringType,
|
VaultTimeoutStringType,
|
||||||
VaultTimeoutAction,
|
VaultTimeoutAction,
|
||||||
} from "@bitwarden/common/key-management/vault-timeout";
|
} from "@bitwarden/common/key-management/vault-timeout";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -67,6 +67,7 @@ describe("AccountSecurityComponent", () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: AccountService, useValue: accountService },
|
{ provide: AccountService, useValue: accountService },
|
||||||
{ provide: AccountSecurityComponent, useValue: mock<AccountSecurityComponent>() },
|
{ provide: AccountSecurityComponent, useValue: mock<AccountSecurityComponent>() },
|
||||||
|
{ provide: ActivatedRoute, useValue: mock<ActivatedRoute>() },
|
||||||
{ provide: BiometricsService, useValue: mock<BiometricsService>() },
|
{ provide: BiometricsService, useValue: mock<BiometricsService>() },
|
||||||
{ provide: BiometricStateService, useValue: biometricStateService },
|
{ provide: BiometricStateService, useValue: biometricStateService },
|
||||||
{ provide: DialogService, useValue: dialogService },
|
{ provide: DialogService, useValue: dialogService },
|
||||||
@@ -88,7 +89,6 @@ describe("AccountSecurityComponent", () => {
|
|||||||
{ provide: LogService, useValue: mock<LogService>() },
|
{ provide: LogService, useValue: mock<LogService>() },
|
||||||
{ provide: OrganizationService, useValue: mock<OrganizationService>() },
|
{ provide: OrganizationService, useValue: mock<OrganizationService>() },
|
||||||
{ provide: CollectionService, useValue: mock<CollectionService>() },
|
{ provide: CollectionService, useValue: mock<CollectionService>() },
|
||||||
{ provide: ConfigService, useValue: mock<ConfigService>() },
|
|
||||||
{ provide: ValidationService, useValue: validationService },
|
{ provide: ValidationService, useValue: validationService },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import { getFirstPolicy } from "@bitwarden/common/admin-console/services/policy/
|
|||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
|
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
|
||||||
import {
|
import {
|
||||||
VaultTimeout,
|
VaultTimeout,
|
||||||
@@ -41,7 +40,6 @@ import {
|
|||||||
VaultTimeoutSettingsService,
|
VaultTimeoutSettingsService,
|
||||||
VaultTimeoutStringType,
|
VaultTimeoutStringType,
|
||||||
} from "@bitwarden/common/key-management/vault-timeout";
|
} from "@bitwarden/common/key-management/vault-timeout";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -115,7 +113,6 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
|
|||||||
biometricUnavailabilityReason: string;
|
biometricUnavailabilityReason: string;
|
||||||
showChangeMasterPass = true;
|
showChangeMasterPass = true;
|
||||||
pinEnabled$: Observable<boolean> = of(true);
|
pinEnabled$: Observable<boolean> = of(true);
|
||||||
extensionLoginApprovalFlagEnabled = false;
|
|
||||||
|
|
||||||
form = this.formBuilder.group({
|
form = this.formBuilder.group({
|
||||||
vaultTimeout: [null as VaultTimeout | null],
|
vaultTimeout: [null as VaultTimeout | null],
|
||||||
@@ -157,7 +154,6 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
|
|||||||
private biometricsService: BiometricsService,
|
private biometricsService: BiometricsService,
|
||||||
private vaultNudgesService: NudgesService,
|
private vaultNudgesService: NudgesService,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private configService: ConfigService,
|
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@@ -239,10 +235,6 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
this.form.patchValue(initialValues, { emitEvent: false });
|
this.form.patchValue(initialValues, { emitEvent: false });
|
||||||
|
|
||||||
this.extensionLoginApprovalFlagEnabled = await this.configService.getFeatureFlag(
|
|
||||||
FeatureFlag.PM14938_BrowserExtensionLoginApproval,
|
|
||||||
);
|
|
||||||
|
|
||||||
timer(0, 1000)
|
timer(0, 1000)
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap(async () => {
|
switchMap(async () => {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {
|
|||||||
} from "@bitwarden/angular/auth/guards";
|
} from "@bitwarden/angular/auth/guards";
|
||||||
import { ChangePasswordComponent } from "@bitwarden/angular/auth/password-management/change-password";
|
import { ChangePasswordComponent } from "@bitwarden/angular/auth/password-management/change-password";
|
||||||
import { SetInitialPasswordComponent } from "@bitwarden/angular/auth/password-management/set-initial-password/set-initial-password.component";
|
import { SetInitialPasswordComponent } from "@bitwarden/angular/auth/password-management/set-initial-password/set-initial-password.component";
|
||||||
import { canAccessFeature } from "@bitwarden/angular/platform/guard/feature-flag.guard";
|
|
||||||
import {
|
import {
|
||||||
DevicesIcon,
|
DevicesIcon,
|
||||||
RegistrationUserAddIcon,
|
RegistrationUserAddIcon,
|
||||||
@@ -40,7 +39,6 @@ import {
|
|||||||
TwoFactorAuthComponent,
|
TwoFactorAuthComponent,
|
||||||
TwoFactorAuthGuard,
|
TwoFactorAuthGuard,
|
||||||
} from "@bitwarden/auth/angular";
|
} from "@bitwarden/auth/angular";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { AnonLayoutWrapperComponent, AnonLayoutWrapperData } from "@bitwarden/components";
|
import { AnonLayoutWrapperComponent, AnonLayoutWrapperData } from "@bitwarden/components";
|
||||||
import { LockComponent, ConfirmKeyConnectorDomainComponent } from "@bitwarden/key-management-ui";
|
import { LockComponent, ConfirmKeyConnectorDomainComponent } from "@bitwarden/key-management-ui";
|
||||||
|
|
||||||
@@ -262,7 +260,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: "device-management",
|
path: "device-management",
|
||||||
component: ExtensionDeviceManagementComponent,
|
component: ExtensionDeviceManagementComponent,
|
||||||
canActivate: [canAccessFeature(FeatureFlag.PM14938_BrowserExtensionLoginApproval), authGuard],
|
canActivate: [authGuard],
|
||||||
data: { elevation: 1 } satisfies RouteDataProperties,
|
data: { elevation: 1 } satisfies RouteDataProperties,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
|||||||
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
|
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||||
import { PendingAuthRequestsStateService } from "@bitwarden/common/auth/services/auth-request-answering/pending-auth-requests.state";
|
import { PendingAuthRequestsStateService } from "@bitwarden/common/auth/services/auth-request-answering/pending-auth-requests.state";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { AnimationControlService } from "@bitwarden/common/platform/abstractions/animation-control.service";
|
import { AnimationControlService } from "@bitwarden/common/platform/abstractions/animation-control.service";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
@@ -82,7 +80,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
private activeUserId: UserId;
|
private activeUserId: UserId;
|
||||||
private routerAnimations = false;
|
private routerAnimations = false;
|
||||||
private processingPendingAuth = false;
|
private processingPendingAuth = false;
|
||||||
private extensionLoginApprovalFeatureFlag = false;
|
|
||||||
|
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
@@ -118,7 +115,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
private authRequestService: AuthRequestServiceAbstraction,
|
private authRequestService: AuthRequestServiceAbstraction,
|
||||||
private pendingAuthRequestsState: PendingAuthRequestsStateService,
|
private pendingAuthRequestsState: PendingAuthRequestsStateService,
|
||||||
private authRequestAnsweringService: AuthRequestAnsweringServiceAbstraction,
|
private authRequestAnsweringService: AuthRequestAnsweringServiceAbstraction,
|
||||||
private readonly configService: ConfigService,
|
|
||||||
) {
|
) {
|
||||||
this.deviceTrustToastService.setupListeners$.pipe(takeUntilDestroyed()).subscribe();
|
this.deviceTrustToastService.setupListeners$.pipe(takeUntilDestroyed()).subscribe();
|
||||||
|
|
||||||
@@ -127,10 +123,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.extensionLoginApprovalFeatureFlag = await firstValueFrom(
|
|
||||||
this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval),
|
|
||||||
);
|
|
||||||
|
|
||||||
initPopupClosedListener();
|
initPopupClosedListener();
|
||||||
|
|
||||||
this.compactModeService.init();
|
this.compactModeService.init();
|
||||||
@@ -140,7 +132,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
this.activeUserId = account?.id;
|
this.activeUserId = account?.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.extensionLoginApprovalFeatureFlag) {
|
|
||||||
// Trigger processing auth requests when the active user is in an unlocked state. Runs once when
|
// Trigger processing auth requests when the active user is in an unlocked state. Runs once when
|
||||||
// the popup is open.
|
// the popup is open.
|
||||||
this.accountService.activeAccount$
|
this.accountService.activeAccount$
|
||||||
@@ -157,7 +148,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
takeUntil(this.destroy$),
|
takeUntil(this.destroy$),
|
||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
}
|
|
||||||
|
|
||||||
this.authService.activeAccountStatus$
|
this.authService.activeAccountStatus$
|
||||||
.pipe(
|
.pipe(
|
||||||
@@ -169,7 +159,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
if (this.extensionLoginApprovalFeatureFlag) {
|
|
||||||
// When the popup is already open and the active account transitions to Unlocked,
|
// When the popup is already open and the active account transitions to Unlocked,
|
||||||
// process any pending auth requests for the active user. The above subscription does not handle
|
// process any pending auth requests for the active user. The above subscription does not handle
|
||||||
// this case.
|
// this case.
|
||||||
@@ -186,7 +175,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
void this.authRequestAnsweringService.processPendingAuthRequests();
|
void this.authRequestAnsweringService.processPendingAuthRequests();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
this.ngZone.runOutsideAngular(() => {
|
this.ngZone.runOutsideAngular(() => {
|
||||||
window.onmousedown = () => this.recordActivity();
|
window.onmousedown = () => this.recordActivity();
|
||||||
@@ -241,10 +229,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.router.navigate(["lock"]);
|
await this.router.navigate(["lock"]);
|
||||||
} else if (
|
} else if (msg.command === "openLoginApproval") {
|
||||||
msg.command === "openLoginApproval" &&
|
|
||||||
this.extensionLoginApprovalFeatureFlag
|
|
||||||
) {
|
|
||||||
if (this.processingPendingAuth) {
|
if (this.processingPendingAuth) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import { Account, AccountService } from "@bitwarden/common/auth/abstractions/acc
|
|||||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
|
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
@@ -319,11 +318,6 @@ export class VaultV2Component<C extends CipherViewLike>
|
|||||||
this.searchBarService.setEnabled(true);
|
this.searchBarService.setEnabled(true);
|
||||||
this.searchBarService.setPlaceholderText(this.i18nService.t("searchVault"));
|
this.searchBarService.setPlaceholderText(this.i18nService.t("searchVault"));
|
||||||
|
|
||||||
if (
|
|
||||||
(await firstValueFrom(
|
|
||||||
this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval),
|
|
||||||
)) === true
|
|
||||||
) {
|
|
||||||
const authRequests = await firstValueFrom(
|
const authRequests = await firstValueFrom(
|
||||||
this.authRequestService.getLatestPendingAuthRequest$(),
|
this.authRequestService.getLatestPendingAuthRequest$(),
|
||||||
);
|
);
|
||||||
@@ -332,14 +326,6 @@ export class VaultV2Component<C extends CipherViewLike>
|
|||||||
notificationId: authRequests.id,
|
notificationId: authRequests.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const authRequest = await this.apiService.getLastAuthRequest();
|
|
||||||
if (authRequest != null) {
|
|
||||||
this.messagingService.send("openLoginApproval", {
|
|
||||||
notificationId: authRequest.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.activeUserId = await firstValueFrom(
|
this.activeUserId = await firstValueFrom(
|
||||||
this.accountService.activeAccount$.pipe(getUserId),
|
this.accountService.activeAccount$.pipe(getUserId),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { TestBed } from "@angular/core/testing";
|
import { TestBed } from "@angular/core/testing";
|
||||||
import { mock, MockProxy } from "jest-mock-extended";
|
import { BehaviorSubject, firstValueFrom, take, timeout } from "rxjs";
|
||||||
import { BehaviorSubject, firstValueFrom, of, take, timeout } from "rxjs";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AuthRequestServiceAbstraction,
|
AuthRequestServiceAbstraction,
|
||||||
@@ -13,7 +12,6 @@ import { DeviceView } from "@bitwarden/common/auth/abstractions/devices/views/de
|
|||||||
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
|
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
|
||||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||||
import { DeviceType } from "@bitwarden/common/enums";
|
import { DeviceType } from "@bitwarden/common/enums";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { StateProvider } from "@bitwarden/common/platform/state";
|
import { StateProvider } from "@bitwarden/common/platform/state";
|
||||||
@@ -45,14 +43,11 @@ describe("VaultBannersService", () => {
|
|||||||
});
|
});
|
||||||
const devices$ = new BehaviorSubject<DeviceView[]>([]);
|
const devices$ = new BehaviorSubject<DeviceView[]>([]);
|
||||||
const pendingAuthRequests$ = new BehaviorSubject<Array<AuthRequestResponse>>([]);
|
const pendingAuthRequests$ = new BehaviorSubject<Array<AuthRequestResponse>>([]);
|
||||||
let configService: MockProxy<ConfigService>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
lastSync$.next(new Date("2024-05-14"));
|
lastSync$.next(new Date("2024-05-14"));
|
||||||
isSelfHost.mockClear();
|
isSelfHost.mockClear();
|
||||||
getEmailVerified.mockClear().mockResolvedValue(true);
|
getEmailVerified.mockClear().mockResolvedValue(true);
|
||||||
configService = mock<ConfigService>();
|
|
||||||
configService.getFeatureFlag$.mockImplementation(() => of(true));
|
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
@@ -99,10 +94,6 @@ describe("VaultBannersService", () => {
|
|||||||
provide: AuthRequestServiceAbstraction,
|
provide: AuthRequestServiceAbstraction,
|
||||||
useValue: { getPendingAuthRequests$: () => pendingAuthRequests$ },
|
useValue: { getPendingAuthRequests$: () => pendingAuthRequests$ },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
provide: ConfigService,
|
|
||||||
useValue: configService,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ import {
|
|||||||
UserDecryptionOptionsServiceAbstraction,
|
UserDecryptionOptionsServiceAbstraction,
|
||||||
} from "@bitwarden/auth/common";
|
} from "@bitwarden/auth/common";
|
||||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||||
import { DevicesServiceAbstraction } from "@bitwarden/common/auth/abstractions/devices/devices.service.abstraction";
|
|
||||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import {
|
import {
|
||||||
StateProvider,
|
StateProvider,
|
||||||
@@ -70,9 +67,7 @@ export class VaultBannersService {
|
|||||||
private kdfConfigService: KdfConfigService,
|
private kdfConfigService: KdfConfigService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private userDecryptionOptionsService: UserDecryptionOptionsServiceAbstraction,
|
private userDecryptionOptionsService: UserDecryptionOptionsServiceAbstraction,
|
||||||
private devicesService: DevicesServiceAbstraction,
|
|
||||||
private authRequestService: AuthRequestServiceAbstraction,
|
private authRequestService: AuthRequestServiceAbstraction,
|
||||||
private configService: ConfigService,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/** Returns true when the pending auth request banner should be shown */
|
/** Returns true when the pending auth request banner should be shown */
|
||||||
@@ -80,24 +75,12 @@ export class VaultBannersService {
|
|||||||
const alreadyDismissed = (await this.getBannerDismissedState(userId)).includes(
|
const alreadyDismissed = (await this.getBannerDismissedState(userId)).includes(
|
||||||
VisibleVaultBanner.PendingAuthRequest,
|
VisibleVaultBanner.PendingAuthRequest,
|
||||||
);
|
);
|
||||||
// TODO: PM-20439 remove feature flag
|
|
||||||
const browserLoginApprovalFeatureFlag = await firstValueFrom(
|
|
||||||
this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval),
|
|
||||||
);
|
|
||||||
if (browserLoginApprovalFeatureFlag === true) {
|
|
||||||
const pendingAuthRequests = await firstValueFrom(
|
const pendingAuthRequests = await firstValueFrom(
|
||||||
this.authRequestService.getPendingAuthRequests$(),
|
this.authRequestService.getPendingAuthRequests$(),
|
||||||
);
|
);
|
||||||
|
|
||||||
return pendingAuthRequests.length > 0 && !alreadyDismissed;
|
return pendingAuthRequests.length > 0 && !alreadyDismissed;
|
||||||
} else {
|
|
||||||
const devices = await firstValueFrom(this.devicesService.getDevices$());
|
|
||||||
const hasPendingRequest = devices.some(
|
|
||||||
(device) => device.response?.devicePendingAuthRequest != null,
|
|
||||||
);
|
|
||||||
|
|
||||||
return hasPendingRequest && !alreadyDismissed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldShowPremiumBanner$(userId: UserId): Observable<boolean> {
|
shouldShowPremiumBanner$(userId: UserId): Observable<boolean> {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export enum FeatureFlag {
|
|||||||
CollectionVaultRefactor = "pm-25030-resolve-ts-upgrade-errors",
|
CollectionVaultRefactor = "pm-25030-resolve-ts-upgrade-errors",
|
||||||
|
|
||||||
/* Auth */
|
/* Auth */
|
||||||
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
|
||||||
PM22110_DisableAlternateLoginMethods = "pm-22110-disable-alternate-login-methods",
|
PM22110_DisableAlternateLoginMethods = "pm-22110-disable-alternate-login-methods",
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
@@ -98,7 +97,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.PM22136_SdkCipherEncryption]: FALSE,
|
[FeatureFlag.PM22136_SdkCipherEncryption]: FALSE,
|
||||||
|
|
||||||
/* Auth */
|
/* Auth */
|
||||||
[FeatureFlag.PM14938_BrowserExtensionLoginApproval]: FALSE,
|
|
||||||
[FeatureFlag.PM22110_DisableAlternateLoginMethods]: FALSE,
|
[FeatureFlag.PM22110_DisableAlternateLoginMethods]: FALSE,
|
||||||
|
|
||||||
/* Billing */
|
/* Billing */
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ describe("DefaultServerNotificationsService (multi-user)", () => {
|
|||||||
const flagValueByFlag: Partial<Record<FeatureFlag, boolean>> = {
|
const flagValueByFlag: Partial<Record<FeatureFlag, boolean>> = {
|
||||||
[FeatureFlag.InactiveUserServerNotification]: true,
|
[FeatureFlag.InactiveUserServerNotification]: true,
|
||||||
[FeatureFlag.PushNotificationsWhenLocked]: true,
|
[FeatureFlag.PushNotificationsWhenLocked]: true,
|
||||||
[FeatureFlag.PM14938_BrowserExtensionLoginApproval]: true,
|
|
||||||
};
|
};
|
||||||
return new BehaviorSubject(flagValueByFlag[flag] ?? false) as any;
|
return new BehaviorSubject(flagValueByFlag[flag] ?? false) as any;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -278,16 +278,21 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer
|
|||||||
await this.syncService.syncDeleteSend(notification.payload as SyncSendNotification);
|
await this.syncService.syncDeleteSend(notification.payload as SyncSendNotification);
|
||||||
break;
|
break;
|
||||||
case NotificationType.AuthRequest:
|
case NotificationType.AuthRequest:
|
||||||
if (
|
|
||||||
await firstValueFrom(
|
|
||||||
this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
await this.authRequestAnsweringService.receivedPendingAuthRequest(
|
await this.authRequestAnsweringService.receivedPendingAuthRequest(
|
||||||
notification.payload.userId,
|
notification.payload.userId,
|
||||||
notification.payload.id,
|
notification.payload.id,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* This call is necessary for Desktop, which for the time being uses a noop for the
|
||||||
|
* authRequestAnsweringService.receivedPendingAuthRequest() call just above. Desktop
|
||||||
|
* will eventually use the new AuthRequestAnsweringService, at which point we can remove
|
||||||
|
* this second call.
|
||||||
|
*
|
||||||
|
* The Extension AppComponent has logic (see processingPendingAuth) that only allows one
|
||||||
|
* pending auth request to process at a time, so this second call will not cause any
|
||||||
|
* duplicate processing conflicts on Extension.
|
||||||
|
*/
|
||||||
this.messagingService.send("openLoginApproval", {
|
this.messagingService.send("openLoginApproval", {
|
||||||
notificationId: notification.payload.id,
|
notificationId: notification.payload.id,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user