Update client for authService refactor (#448)
* Update for encrypted export support (to pass build only)
This commit is contained in:
parent
d938dc82df
commit
220afb98c6
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit e0cc754d6fe962a5e7eae6d1dead8b44606d4853
|
Subproject commit 6b8508579f89b4c54afa6aab2b7155aac70fb8a9
|
21
src/bw.ts
21
src/bw.ts
|
@ -39,6 +39,7 @@ import { StateMigrationService } from "jslib-common/services/stateMigration.serv
|
||||||
import { SyncService } from "jslib-common/services/sync.service";
|
import { SyncService } from "jslib-common/services/sync.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 { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
|
import { VaultTimeoutService } from "jslib-common/services/vaultTimeout.service";
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ import { VaultProgram } from "./vault.program";
|
||||||
|
|
||||||
import { Account } from "jslib-common/models/domain/account";
|
import { Account } from "jslib-common/models/domain/account";
|
||||||
import { GlobalState } from "jslib-common/models/domain/globalState";
|
import { GlobalState } from "jslib-common/models/domain/globalState";
|
||||||
|
import { ApiLogInCredentials } from "jslib-common/models/domain/logInCredentials";
|
||||||
|
|
||||||
import { StateFactory } from "jslib-common/factories/stateFactory";
|
import { StateFactory } from "jslib-common/factories/stateFactory";
|
||||||
|
|
||||||
|
@ -100,6 +102,7 @@ export class Main {
|
||||||
stateMigrationService: StateMigrationService;
|
stateMigrationService: StateMigrationService;
|
||||||
organizationService: OrganizationService;
|
organizationService: OrganizationService;
|
||||||
providerService: ProviderService;
|
providerService: ProviderService;
|
||||||
|
twoFactorService: TwoFactorService;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
let p = null;
|
let p = null;
|
||||||
|
@ -167,7 +170,8 @@ export class Main {
|
||||||
" (" +
|
" (" +
|
||||||
this.platformUtilsService.getDeviceString().toUpperCase() +
|
this.platformUtilsService.getDeviceString().toUpperCase() +
|
||||||
")",
|
")",
|
||||||
(clientId, clientSecret) => this.authService.logInApiKey(clientId, clientSecret)
|
(clientId, clientSecret) =>
|
||||||
|
this.authService.logIn(new ApiLogInCredentials(clientId, clientSecret))
|
||||||
);
|
);
|
||||||
this.containerService = new ContainerService(this.cryptoService);
|
this.containerService = new ContainerService(this.cryptoService);
|
||||||
|
|
||||||
|
@ -227,7 +231,8 @@ export class Main {
|
||||||
this.apiService,
|
this.apiService,
|
||||||
this.tokenService,
|
this.tokenService,
|
||||||
this.logService,
|
this.logService,
|
||||||
this.organizationService
|
this.organizationService,
|
||||||
|
this.cryptoFunctionService
|
||||||
);
|
);
|
||||||
|
|
||||||
this.vaultTimeoutService = new VaultTimeoutService(
|
this.vaultTimeoutService = new VaultTimeoutService(
|
||||||
|
@ -289,24 +294,24 @@ export class Main {
|
||||||
this.folderService,
|
this.folderService,
|
||||||
this.cipherService,
|
this.cipherService,
|
||||||
this.apiService,
|
this.apiService,
|
||||||
this.cryptoService
|
this.cryptoService,
|
||||||
|
this.cryptoFunctionService
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.twoFactorService = new TwoFactorService(this.i18nService, this.platformUtilsService);
|
||||||
|
|
||||||
this.authService = new AuthService(
|
this.authService = new AuthService(
|
||||||
this.cryptoService,
|
this.cryptoService,
|
||||||
this.apiService,
|
this.apiService,
|
||||||
this.tokenService,
|
this.tokenService,
|
||||||
this.appIdService,
|
this.appIdService,
|
||||||
this.i18nService,
|
|
||||||
this.platformUtilsService,
|
this.platformUtilsService,
|
||||||
this.messagingService,
|
this.messagingService,
|
||||||
this.vaultTimeoutService,
|
|
||||||
this.logService,
|
this.logService,
|
||||||
this.cryptoFunctionService,
|
|
||||||
this.keyConnectorService,
|
this.keyConnectorService,
|
||||||
this.environmentService,
|
this.environmentService,
|
||||||
this.stateService,
|
this.stateService,
|
||||||
true
|
this.twoFactorService
|
||||||
);
|
);
|
||||||
|
|
||||||
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
|
||||||
|
@ -361,7 +366,7 @@ export class Main {
|
||||||
await this.environmentService.setUrlsFromStorage();
|
await this.environmentService.setUrlsFromStorage();
|
||||||
const locale = await this.stateService.getLocale();
|
const locale = await this.stateService.getLocale();
|
||||||
await this.i18nService.init(locale);
|
await this.i18nService.init(locale);
|
||||||
this.authService.init();
|
this.twoFactorService.init();
|
||||||
|
|
||||||
const installedVersion = await this.stateService.getInstalledVersion();
|
const installedVersion = await this.stateService.getInstalledVersion();
|
||||||
const currentVersion = await this.platformUtilsService.getApplicationVersion();
|
const currentVersion = await this.platformUtilsService.getApplicationVersion();
|
||||||
|
|
|
@ -2,6 +2,8 @@ import * as program from "commander";
|
||||||
import { ImportService } from "jslib-common/abstractions/import.service";
|
import { ImportService } from "jslib-common/abstractions/import.service";
|
||||||
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
import { OrganizationService } from "jslib-common/abstractions/organization.service";
|
||||||
|
|
||||||
|
import { ImportType } from "jslib-common/services/import.service";
|
||||||
|
|
||||||
import { Response } from "jslib-node/cli/models/response";
|
import { Response } from "jslib-node/cli/models/response";
|
||||||
import { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
|
import { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
|
||||||
|
|
||||||
|
@ -13,7 +15,11 @@ export class ImportCommand {
|
||||||
private organizationService: OrganizationService
|
private organizationService: OrganizationService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async run(format: string, filepath: string, options: program.OptionValues): Promise<Response> {
|
async run(
|
||||||
|
format: ImportType,
|
||||||
|
filepath: string,
|
||||||
|
options: program.OptionValues
|
||||||
|
): Promise<Response> {
|
||||||
const organizationId = options.organizationid;
|
const organizationId = options.organizationid;
|
||||||
if (organizationId != null) {
|
if (organizationId != null) {
|
||||||
const organization = await this.organizationService.get(organizationId);
|
const organization = await this.organizationService.get(organizationId);
|
||||||
|
@ -38,8 +44,8 @@ export class ImportCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async import(format: string, filepath: string, organizationId: string) {
|
private async import(format: ImportType, filepath: string, organizationId: string) {
|
||||||
if (format == null || format === "") {
|
if (format == null) {
|
||||||
return Response.badRequest("`format` was not provided.");
|
return Response.badRequest("`format` was not provided.");
|
||||||
}
|
}
|
||||||
if (filepath == null || filepath === "") {
|
if (filepath == null || filepath === "") {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { PlatformUtilsService } from "jslib-common/abstractions/platformUtils.se
|
||||||
import { PolicyService } from "jslib-common/abstractions/policy.service";
|
import { PolicyService } from "jslib-common/abstractions/policy.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 { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
|
import { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ export class LoginCommand extends BaseLoginCommand {
|
||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
cryptoService: CryptoService,
|
cryptoService: CryptoService,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
|
twoFactorService: TwoFactorService,
|
||||||
private syncService: SyncService,
|
private syncService: SyncService,
|
||||||
private keyConnectorService: KeyConnectorService,
|
private keyConnectorService: KeyConnectorService,
|
||||||
private logoutCallback: () => Promise<void>
|
private logoutCallback: () => Promise<void>
|
||||||
|
@ -48,6 +50,7 @@ export class LoginCommand extends BaseLoginCommand {
|
||||||
stateService,
|
stateService,
|
||||||
cryptoService,
|
cryptoService,
|
||||||
policyService,
|
policyService,
|
||||||
|
twoFactorService,
|
||||||
"cli"
|
"cli"
|
||||||
);
|
);
|
||||||
this.logout = this.logoutCallback;
|
this.logout = this.logoutCallback;
|
||||||
|
|
|
@ -156,6 +156,7 @@ export class Program extends BaseProgram {
|
||||||
this.main.stateService,
|
this.main.stateService,
|
||||||
this.main.cryptoService,
|
this.main.cryptoService,
|
||||||
this.main.policyService,
|
this.main.policyService,
|
||||||
|
this.main.twoFactorService,
|
||||||
this.main.syncService,
|
this.main.syncService,
|
||||||
this.main.keyConnectorService,
|
this.main.keyConnectorService,
|
||||||
async () => await this.main.logout()
|
async () => await this.main.logout()
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"target": "ES2016",
|
"target": "ES2016",
|
||||||
"module": "es6",
|
"module": "es6",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
|
Loading…
Reference in New Issue