1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

refactor(auth): initialize new logout lib

This commit is contained in:
addisonbeck
2025-05-27 14:12:01 -04:00
parent 32e6f44e7a
commit 0564f0ee9f
24 changed files with 60 additions and 33 deletions

1
.github/CODEOWNERS vendored
View File

@@ -18,6 +18,7 @@ apps/cli/src/auth @bitwarden/team-auth-dev
apps/desktop/src/auth @bitwarden/team-auth-dev
apps/web/src/app/auth @bitwarden/team-auth-dev
libs/auth @bitwarden/team-auth-dev
libs/logout @bitwarden/team-auth-dev
# web connectors used for auth
apps/web/src/connectors @bitwarden/team-auth-dev
bitwarden_license/bit-web/src/app/auth @bitwarden/team-auth-dev

View File

@@ -11,7 +11,6 @@ import {
DefaultLockService,
InternalUserDecryptionOptionsServiceAbstraction,
LoginEmailServiceAbstraction,
LogoutReason,
PinService,
PinServiceAbstraction,
UserDecryptionOptionsService,
@@ -228,6 +227,7 @@ import {
KdfConfigService,
KeyService as KeyServiceAbstraction,
} from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { BackgroundSyncService } from "@bitwarden/platform/background-sync";
import {
IndividualVaultExportService,

View File

@@ -6,7 +6,6 @@ import { NavigationEnd, Router, RouterOutlet } from "@angular/router";
import { Subject, takeUntil, firstValueFrom, concatMap, filter, tap } from "rxjs";
import { DeviceTrustToastService } from "@bitwarden/angular/auth/services/device-trust-toast.service.abstraction";
import { LogoutReason } from "@bitwarden/auth/common";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
@@ -24,6 +23,7 @@ import {
ToastService,
} from "@bitwarden/components";
import { BiometricsService, BiometricStateService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { PopupCompactModeService } from "../platform/popup/layout/popup-compact-mode.service";
import { PopupSizeService } from "../platform/popup/layout/popup-size.service";

View File

@@ -27,7 +27,7 @@ import { DeviceTrustToastService } from "@bitwarden/angular/auth/services/device
import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { FingerprintDialogComponent, LoginApprovalComponent } from "@bitwarden/auth/angular";
import { DESKTOP_SSO_CALLBACK, LogoutReason } from "@bitwarden/auth/common";
import { DESKTOP_SSO_CALLBACK } from "@bitwarden/auth/common";
import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
import { SearchService } from "@bitwarden/common/abstractions/search.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
@@ -65,6 +65,7 @@ import { CipherType } from "@bitwarden/common/vault/enums";
import { DialogRef, DialogService, ToastOptions, ToastService } from "@bitwarden/components";
import { CredentialGeneratorHistoryDialogComponent } from "@bitwarden/generator-components";
import { KeyService, BiometricStateService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { AddEditFolderDialogComponent, AddEditFolderDialogResult } from "@bitwarden/vault";
import { DeleteAccountComponent } from "../auth/delete-account.component";

View File

@@ -3,8 +3,7 @@
import { Observable, Subject } from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { ClientType } from "@bitwarden/common/enums";
import { VaultTimeout } from "@bitwarden/common/key-management/vault-timeout";
import { RegionConfig } from "@bitwarden/common/platform/abstractions/environment.service";
@@ -16,6 +15,7 @@ import { Theme } from "@bitwarden/common/platform/enums";
import { StateFactory } from "@bitwarden/common/platform/factories/state-factory";
import { Message } from "@bitwarden/common/platform/messaging";
import { HttpOperations } from "@bitwarden/common/services/api.service";
import { LogoutReason } from "@bitwarden/logout";
import { SafeInjectionToken } from "@bitwarden/ui-common";
// Re-export the SafeInjectionToken from ui-common
export { SafeInjectionToken } from "@bitwarden/ui-common";

View File

@@ -49,7 +49,6 @@ import {
LoginStrategyService,
LoginStrategyServiceAbstraction,
LoginSuccessHandlerService,
LogoutReason,
PinService,
PinServiceAbstraction,
UserDecryptionOptionsService,
@@ -321,6 +320,7 @@ import {
UserAsymmetricKeysRegenerationApiService,
UserAsymmetricKeysRegenerationService,
} from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { SafeInjectionToken } from "@bitwarden/ui-common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports

View File

@@ -3,7 +3,6 @@
*/
export * from "./abstractions";
export * from "./models";
export * from "./types";
export * from "./services";
export * from "./utilities";
export * from "./login-strategies";

View File

@@ -4,8 +4,8 @@ import { MockProxy, mock } from "jest-mock-extended";
import { firstValueFrom } from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { FakeSingleUserStateProvider, FakeGlobalStateProvider } from "../../../spec";
import { EncryptService } from "../../key-management/crypto/abstractions/encrypt.service";

View File

@@ -5,7 +5,8 @@ import { Opaque } from "type-fest";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason, decodeJwtTokenToJson } from "@bitwarden/auth/common";
import { decodeJwtTokenToJson } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { EncryptService } from "../../key-management/crypto/abstractions/encrypt.service";
import {

View File

@@ -3,8 +3,7 @@
import { combineLatest, filter, firstValueFrom, Observable, of, switchMap } from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
@@ -15,6 +14,7 @@ import {
KeyService,
KdfType,
} from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { ApiService } from "../../../abstractions/api.service";
import { OrganizationService } from "../../../admin-console/abstractions/organization/organization.service.abstraction";

View File

@@ -8,10 +8,8 @@ import { BehaviorSubject, from, of } from "rxjs";
import { CollectionService } from "@bitwarden/admin-console/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { BiometricsService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { FakeAccountService, mockAccountServiceWith } from "../../../../spec";
import { SearchService } from "../../../abstractions/search.service";

View File

@@ -7,10 +7,8 @@ import { combineLatest, concatMap, filter, firstValueFrom, map, timeout } from "
import { CollectionService } from "@bitwarden/admin-console/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { BiometricsService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { SearchService } from "../../../abstractions/search.service";
import { AccountService } from "../../../auth/abstractions/account.service";

View File

@@ -2,8 +2,8 @@ import { mock, MockProxy } from "jest-mock-extended";
import { BehaviorSubject, bufferCount, firstValueFrom, ObservedValueOf, Subject } from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { awaitAsync } from "../../../../spec";
import { Matrix } from "../../../../spec/matrix";

View File

@@ -12,8 +12,8 @@ import {
} from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { AccountService } from "../../../auth/abstractions/account.service";
import { AuthService } from "../../../auth/abstractions/auth.service";

View File

@@ -7,13 +7,13 @@ import { CollectionService } from "@bitwarden/admin-console/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import {
LogoutReason,
UserDecryptionOptions,
UserDecryptionOptionsServiceAbstraction,
} from "@bitwarden/auth/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { KeyService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
import { Matrix } from "../../../spec/matrix";
import { ApiService } from "../../abstractions/api.service";

View File

@@ -12,13 +12,11 @@ import {
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { KeyService } from "@bitwarden/key-management";
import { LogoutReason } from "@bitwarden/logout";
// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { UserDecryptionOptionsServiceAbstraction } from "../../../../auth/src/common/abstractions";
// FIXME: remove `src` and fix import
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "../../../../auth/src/common/types";
import { ApiService } from "../../abstractions/api.service";
import { InternalOrganizationServiceAbstraction } from "../../admin-console/abstractions/organization/organization.service.abstraction";
import { InternalPolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction";

View File

@@ -1,9 +1,7 @@
import { mock, MockProxy } from "jest-mock-extended";
import { of } from "rxjs";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { TokenService } from "../auth/abstractions/token.service";
import { DeviceType } from "../enums";

View File

@@ -10,9 +10,7 @@ import {
CollectionRequest,
CollectionResponse,
} from "@bitwarden/admin-console/common";
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
// eslint-disable-next-line no-restricted-imports
import { LogoutReason } from "@bitwarden/auth/common";
import { LogoutReason } from "@bitwarden/logout";
import { ApiService as ApiServiceAbstraction } from "../abstractions/api.service";
import { OrganizationConnectionType } from "../admin-console/enums";

20
libs/logout/package.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "@bitwarden/logout",
"version": "0.0.0",
"description": "Services and models pertaining to logout",
"keywords": [
"bitwarden"
],
"author": "Bitwarden Inc.",
"homepage": "https://bitwarden.com",
"repository": {
"type": "git",
"url": "https://github.com/bitwarden/clients"
},
"license": "GPL-3.0",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && tsc",
"build:watch": "npm run clean && tsc -watch"
}
}

View File

@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.base",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

9
package-lock.json generated
View File

@@ -292,6 +292,11 @@
"version": "0.0.0",
"license": "GPL-3.0"
},
"libs/logout": {
"name": "@bitwarden/logout",
"version": "0.0.0",
"license": "GPL-3.0"
},
"libs/node": {
"name": "@bitwarden/node",
"version": "0.0.0",
@@ -5201,6 +5206,10 @@
"resolved": "libs/key-management-ui",
"link": true
},
"node_modules/@bitwarden/logout": {
"resolved": "libs/logout",
"link": true
},
"node_modules/@bitwarden/node": {
"resolved": "libs/node",
"link": true

View File

@@ -46,7 +46,8 @@
"@bitwarden/vault-export-core": ["./libs/tools/export/vault-export/vault-export-core/src"],
"@bitwarden/vault-export-ui": ["./libs/tools/export/vault-export/vault-export-ui/src"],
"@bitwarden/vault": ["./libs/vault/src"],
"@bitwarden/web-vault/*": ["./apps/web/src/*"]
"@bitwarden/web-vault/*": ["./apps/web/src/*"],
"@bitwarden/logout": ["./libs/logout/src"]
},
"plugins": [
{