Update client for authService refactor (#2302)
This commit is contained in:
parent
a6272d4092
commit
7d43835ea2
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit e0cc754d6fe962a5e7eae6d1dead8b44606d4853
|
||||
Subproject commit 6b8508579f89b4c54afa6aab2b7155aac70fb8a9
|
|
@ -32,6 +32,7 @@ import { SyncService } from "jslib-common/services/sync.service";
|
|||
import { SystemService } from "jslib-common/services/system.service";
|
||||
import { TokenService } from "jslib-common/services/token.service";
|
||||
import { TotpService } from "jslib-common/services/totp.service";
|
||||
import { TwoFactorService } from "jslib-common/services/twoFactor.service";
|
||||
import { UserVerificationService } from "jslib-common/services/userVerification.service";
|
||||
import { WebCryptoFunctionService } from "jslib-common/services/webCryptoFunction.service";
|
||||
|
||||
|
@ -66,6 +67,7 @@ import { SyncService as SyncServiceAbstraction } from "jslib-common/abstractions
|
|||
import { SystemService as SystemServiceAbstraction } from "jslib-common/abstractions/system.service";
|
||||
import { TokenService as TokenServiceAbstraction } from "jslib-common/abstractions/token.service";
|
||||
import { TotpService as TotpServiceAbstraction } from "jslib-common/abstractions/totp.service";
|
||||
import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service";
|
||||
import { UserVerificationService as UserVerificationServiceAbstraction } from "jslib-common/abstractions/userVerification.service";
|
||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
|
@ -141,6 +143,7 @@ export default class MainBackground {
|
|||
providerService: ProviderServiceAbstraction;
|
||||
keyConnectorService: KeyConnectorServiceAbstraction;
|
||||
userVerificationService: UserVerificationServiceAbstraction;
|
||||
twoFactorService: TwoFactorServiceAbstraction;
|
||||
|
||||
onUpdatedRan: boolean;
|
||||
onReplacedRan: boolean;
|
||||
|
@ -264,7 +267,8 @@ export default class MainBackground {
|
|||
this.apiService,
|
||||
this.tokenService,
|
||||
this.logService,
|
||||
this.organizationService
|
||||
this.organizationService,
|
||||
this.cryptoFunctionService
|
||||
);
|
||||
|
||||
const vaultTimeoutServiceCallbacks = {
|
||||
|
@ -345,7 +349,8 @@ export default class MainBackground {
|
|||
this.folderService,
|
||||
this.cipherService,
|
||||
this.apiService,
|
||||
this.cryptoService
|
||||
this.cryptoService,
|
||||
this.cryptoFunctionService
|
||||
);
|
||||
this.notificationsService = new NotificationsService(
|
||||
this.syncService,
|
||||
|
@ -451,6 +456,8 @@ export default class MainBackground {
|
|||
);
|
||||
this.windowsBackground = new WindowsBackground(this);
|
||||
|
||||
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
||||
|
||||
const that = this;
|
||||
const backgroundMessagingService = new (class extends MessagingServiceAbstraction {
|
||||
// AuthService should send the messages to the background not popup.
|
||||
|
@ -464,15 +471,13 @@ export default class MainBackground {
|
|||
this.apiService,
|
||||
this.tokenService,
|
||||
this.appIdService,
|
||||
this.i18nService,
|
||||
this.platformUtilsService,
|
||||
backgroundMessagingService,
|
||||
this.vaultTimeoutService,
|
||||
this.logService,
|
||||
this.cryptoFunctionService,
|
||||
this.keyConnectorService,
|
||||
this.environmentService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
this.twoFactorService
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -481,7 +486,6 @@ export default class MainBackground {
|
|||
|
||||
await this.stateService.init();
|
||||
|
||||
(this.authService as AuthService).init();
|
||||
await (this.vaultTimeoutService as VaultTimeoutService).init(true);
|
||||
await (this.i18nService as I18nService).init();
|
||||
await (this.eventService as EventService).init(true);
|
||||
|
@ -489,6 +493,8 @@ export default class MainBackground {
|
|||
await this.notificationBackground.init();
|
||||
await this.commandsBackground.init();
|
||||
|
||||
this.twoFactorService.init();
|
||||
|
||||
await this.tabsBackground.init();
|
||||
await this.contextMenusBackground.init();
|
||||
await this.idleBackground.init();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Component } from "@angular/core";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
import { AuthService } from "jslib-common/abstractions/auth.service";
|
||||
import { I18nService } from "jslib-common/abstractions/i18n.service";
|
||||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
|
||||
|
||||
import { TwoFactorOptionsComponent as BaseTwoFactorOptionsComponent } from "jslib-angular/components/two-factor-options.component";
|
||||
|
||||
|
@ -13,17 +13,17 @@ import { TwoFactorOptionsComponent as BaseTwoFactorOptionsComponent } from "jsli
|
|||
})
|
||||
export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent {
|
||||
constructor(
|
||||
authService: AuthService,
|
||||
twoFactorService: TwoFactorService,
|
||||
router: Router,
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService
|
||||
) {
|
||||
super(authService, router, i18nService, platformUtilsService, window);
|
||||
super(twoFactorService, router, i18nService, platformUtilsService, window);
|
||||
}
|
||||
|
||||
choose(p: any) {
|
||||
super.choose(p);
|
||||
this.authService.selectedTwoFactorProviderType = p.type;
|
||||
this.twoFactorService.setSelectedProvider(p.type);
|
||||
this.router.navigate(["2fa"]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import { MessagingService } from "jslib-common/abstractions/messaging.service";
|
|||
import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.service";
|
||||
import { StateService } from "jslib-common/abstractions/state.service";
|
||||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
|
||||
|
||||
import { TwoFactorComponent as BaseTwoFactorComponent } from "jslib-angular/components/two-factor.component";
|
||||
|
||||
|
@ -43,7 +44,8 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||
stateService: StateService,
|
||||
route: ActivatedRoute,
|
||||
private messagingService: MessagingService,
|
||||
logService: LogService
|
||||
logService: LogService,
|
||||
twoFactorService: TwoFactorService
|
||||
) {
|
||||
super(
|
||||
authService,
|
||||
|
@ -55,7 +57,8 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
|
|||
environmentService,
|
||||
stateService,
|
||||
route,
|
||||
logService
|
||||
logService,
|
||||
twoFactorService
|
||||
);
|
||||
super.onSuccessfulLogin = () => {
|
||||
return syncService.fullSync(true);
|
||||
|
|
|
@ -44,6 +44,7 @@ import { StorageService as StorageServiceAbstraction } from "jslib-common/abstra
|
|||
import { SyncService } from "jslib-common/abstractions/sync.service";
|
||||
import { TokenService } from "jslib-common/abstractions/token.service";
|
||||
import { TotpService } from "jslib-common/abstractions/totp.service";
|
||||
import { TwoFactorService } from "jslib-common/abstractions/twoFactor.service";
|
||||
import { UserVerificationService } from "jslib-common/abstractions/userVerification.service";
|
||||
import { VaultTimeoutService } from "jslib-common/abstractions/vaultTimeout.service";
|
||||
|
||||
|
@ -147,6 +148,11 @@ export function initFactory(
|
|||
DebounceNavigationService,
|
||||
PopupUtilsService,
|
||||
{ provide: MessagingService, useClass: BrowserMessagingService },
|
||||
{
|
||||
provide: TwoFactorService,
|
||||
useFactory: getBgService<TwoFactorService>("twoFactorService"),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: AuthServiceAbstraction,
|
||||
useFactory: getBgService<AuthService>("authService"),
|
||||
|
|
Loading…
Reference in New Issue