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