From 240167328d5138edc984e3d8f4bfb96ddffb5b8c Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:50:25 -0700 Subject: [PATCH] move service to libs/auth/angular and update DI --- .../change-password/web-change-password.service.ts | 2 +- apps/web/src/app/core/core.module.ts | 9 +++------ libs/angular/src/services/jslib-services.module.ts | 4 ++-- .../angular/change-password/change-password.component.ts | 3 ++- .../change-password.service.abstraction.ts | 0 .../default-change-password.service.spec.ts | 3 +-- .../change-password/default-change-password.service.ts | 4 +--- libs/auth/src/angular/index.ts | 2 ++ libs/auth/src/common/abstractions/index.ts | 1 - libs/auth/src/common/services/index.ts | 1 - 10 files changed, 12 insertions(+), 17 deletions(-) rename libs/auth/src/{common/abstractions => angular/change-password}/change-password.service.abstraction.ts (100%) rename libs/auth/src/{common/services => angular}/change-password/default-change-password.service.spec.ts (97%) rename libs/auth/src/{common/services => angular}/change-password/default-change-password.service.ts (95%) diff --git a/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts b/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts index af2c889babe..d9fc7036576 100644 --- a/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts +++ b/apps/web/src/app/auth/core/services/change-password/web-change-password.service.ts @@ -1,6 +1,6 @@ import { inject } from "@angular/core"; -import { ChangePasswordService, DefaultChangePasswordService } from "@bitwarden/auth/common"; +import { ChangePasswordService, DefaultChangePasswordService } from "@bitwarden/auth/angular"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; import { UserKeyRotationService } from "@bitwarden/web-vault/app/key-management/key-rotation/user-key-rotation.service"; diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index 1f6bdbc93f5..10ed9858dac 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -35,9 +35,9 @@ import { LoginDecryptionOptionsService, TwoFactorAuthComponentService, TwoFactorAuthDuoComponentService, + ChangePasswordService, } from "@bitwarden/auth/angular"; import { - ChangePasswordService, InternalUserDecryptionOptionsServiceAbstraction, LoginEmailService, } from "@bitwarden/auth/common"; @@ -51,10 +51,7 @@ import { import { AccountApiService as AccountApiServiceAbstraction } from "@bitwarden/common/auth/abstractions/account-api.service"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; -import { - MasterPasswordApiService, - MasterPasswordApiService as MasterPasswordApiServiceAbstraction, -} from "@bitwarden/common/auth/abstractions/master-password-api.service.abstraction"; +import { MasterPasswordApiService } from "@bitwarden/common/auth/abstractions/master-password-api.service.abstraction"; import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { ClientType } from "@bitwarden/common/enums"; import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service"; @@ -390,7 +387,7 @@ const safeProviders: SafeProvider[] = [ useClass: WebChangePasswordService, deps: [ KeyServiceAbstraction, - MasterPasswordApiServiceAbstraction, + MasterPasswordApiService, InternalMasterPasswordServiceAbstraction, ], }), diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index ae462f19969..3d7e4807982 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -27,6 +27,8 @@ import { TwoFactorAuthComponentService, TwoFactorAuthEmailComponentService, TwoFactorAuthWebAuthnComponentService, + ChangePasswordService, + DefaultChangePasswordService, } from "@bitwarden/auth/angular"; import { AuthRequestApiService, @@ -46,8 +48,6 @@ import { PinServiceAbstraction, UserDecryptionOptionsService, UserDecryptionOptionsServiceAbstraction, - ChangePasswordService, - DefaultChangePasswordService, } from "@bitwarden/auth/common"; import { ApiService as ApiServiceAbstraction } from "@bitwarden/common/abstractions/api.service"; import { AuditService as AuditServiceAbstraction } from "@bitwarden/common/abstractions/audit.service"; diff --git a/libs/auth/src/angular/change-password/change-password.component.ts b/libs/auth/src/angular/change-password/change-password.component.ts index 8ee49a07f21..e2d2cf2062e 100644 --- a/libs/auth/src/angular/change-password/change-password.component.ts +++ b/libs/auth/src/angular/change-password/change-password.component.ts @@ -1,7 +1,6 @@ import { Component, Input, OnInit } from "@angular/core"; import { firstValueFrom } from "rxjs"; -import { ChangePasswordService } from "@bitwarden/auth/common"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options"; import { Account, AccountService } from "@bitwarden/common/auth/abstractions/account.service"; @@ -25,6 +24,8 @@ import { } from "../input-password/input-password.component"; import { PasswordInputResult } from "../input-password/password-input-result"; +import { ChangePasswordService } from "./change-password.service.abstraction"; + @Component({ standalone: true, selector: "auth-change-password", diff --git a/libs/auth/src/common/abstractions/change-password.service.abstraction.ts b/libs/auth/src/angular/change-password/change-password.service.abstraction.ts similarity index 100% rename from libs/auth/src/common/abstractions/change-password.service.abstraction.ts rename to libs/auth/src/angular/change-password/change-password.service.abstraction.ts diff --git a/libs/auth/src/common/services/change-password/default-change-password.service.spec.ts b/libs/auth/src/angular/change-password/default-change-password.service.spec.ts similarity index 97% rename from libs/auth/src/common/services/change-password/default-change-password.service.spec.ts rename to libs/auth/src/angular/change-password/default-change-password.service.spec.ts index cb820c12f35..03d614f6654 100644 --- a/libs/auth/src/common/services/change-password/default-change-password.service.spec.ts +++ b/libs/auth/src/angular/change-password/default-change-password.service.spec.ts @@ -8,8 +8,7 @@ import { UserId } from "@bitwarden/common/types/guid"; import { MasterKey, UserKey } from "@bitwarden/common/types/key"; import { KeyService, PBKDF2KdfConfig } from "@bitwarden/key-management"; -import { ChangePasswordService } from "../../abstractions"; - +import { ChangePasswordService } from "./change-password.service.abstraction"; import { DefaultChangePasswordService } from "./default-change-password.service"; describe("DefaultChangePasswordService", () => { diff --git a/libs/auth/src/common/services/change-password/default-change-password.service.ts b/libs/auth/src/angular/change-password/default-change-password.service.ts similarity index 95% rename from libs/auth/src/common/services/change-password/default-change-password.service.ts rename to libs/auth/src/angular/change-password/default-change-password.service.ts index 3fa3a86b189..4ed89d1a080 100644 --- a/libs/auth/src/common/services/change-password/default-change-password.service.ts +++ b/libs/auth/src/angular/change-password/default-change-password.service.ts @@ -1,4 +1,4 @@ -import { PasswordInputResult } from "@bitwarden/auth/angular"; +import { PasswordInputResult, ChangePasswordService } from "@bitwarden/auth/angular"; import { Account } from "@bitwarden/common/auth/abstractions/account.service"; import { MasterPasswordApiService } from "@bitwarden/common/auth/abstractions/master-password-api.service.abstraction"; import { PasswordRequest } from "@bitwarden/common/auth/models/request/password.request"; @@ -6,8 +6,6 @@ import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/key- import { UserId } from "@bitwarden/common/types/guid"; import { KeyService } from "@bitwarden/key-management"; -import { ChangePasswordService } from "../../abstractions"; - export class DefaultChangePasswordService implements ChangePasswordService { constructor( private keyService: KeyService, diff --git a/libs/auth/src/angular/index.ts b/libs/auth/src/angular/index.ts index 5566aef1ab6..f4f6cc71a42 100644 --- a/libs/auth/src/angular/index.ts +++ b/libs/auth/src/angular/index.ts @@ -10,6 +10,8 @@ export * from "./anon-layout/default-anon-layout-wrapper-data.service"; // change password export * from "./change-password/change-password.component"; +export * from "./change-password/change-password.service.abstraction"; +export * from "./change-password/default-change-password.service"; // fingerprint dialog export * from "./fingerprint-dialog/fingerprint-dialog.component"; diff --git a/libs/auth/src/common/abstractions/index.ts b/libs/auth/src/common/abstractions/index.ts index 796db3baf9d..c0dc500ddb9 100644 --- a/libs/auth/src/common/abstractions/index.ts +++ b/libs/auth/src/common/abstractions/index.ts @@ -1,5 +1,4 @@ export * from "./auth-request-api.service"; -export * from "./change-password.service.abstraction"; export * from "./pin.service.abstraction"; export * from "./login-email.service"; export * from "./login-strategy.service"; diff --git a/libs/auth/src/common/services/index.ts b/libs/auth/src/common/services/index.ts index 38bc3519721..73d31799b7e 100644 --- a/libs/auth/src/common/services/index.ts +++ b/libs/auth/src/common/services/index.ts @@ -1,4 +1,3 @@ -export * from "./change-password/default-change-password.service"; export * from "./pin/pin.service.implementation"; export * from "./login-email/login-email.service"; export * from "./login-strategies/login-strategy.service";