mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
* Use different strategy classes for different types of login * General refactor and cleanup of auth logic * Create subclasses for different types of login credentials * Create subclasses for different types of tokenRequests * Create TwoFactorService, move code out of authService * refactor base CLI commands to use new interface
24 lines
872 B
TypeScript
24 lines
872 B
TypeScript
import { AuthResult } from "../models/domain/authResult";
|
|
import {
|
|
ApiLogInCredentials,
|
|
PasswordLogInCredentials,
|
|
SsoLogInCredentials,
|
|
} from "../models/domain/logInCredentials";
|
|
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|
|
|
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequest";
|
|
|
|
export abstract class AuthService {
|
|
masterPasswordHash: string;
|
|
email: string;
|
|
logIn: (
|
|
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
|
|
) => Promise<AuthResult>;
|
|
logInTwoFactor: (twoFactor: TokenRequestTwoFactor) => Promise<AuthResult>;
|
|
logOut: (callback: Function) => void;
|
|
makePreloginKey: (masterPassword: string, email: string) => Promise<SymmetricCryptoKey>;
|
|
authingWithApiKey: () => boolean;
|
|
authingWithSso: () => boolean;
|
|
authingWithPassword: () => boolean;
|
|
}
|