mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-19 07:35:48 +02:00
79b856cb6e
* Added support for authenticating with an API key * added api service methods for user api keys * fixed a copy/pasted api endpoint url * Let toIdentityToken() use a a prestored client_id in place of the application client_id if one exists * Allowed for api key auth in the cli * Removed some commented out code commited for apiKey auth * Cleanup for ApiKey auth in the CLI * Removed cli prefix from client_crendential auth types * Removed ClientPrefix conditional from decoded token getters * Update src/services/api.service.ts Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * formatting * changed command from login --apiKey to login --apikey Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
36 lines
1.9 KiB
TypeScript
36 lines
1.9 KiB
TypeScript
import { TwoFactorProviderType } from '../enums/twoFactorProviderType';
|
|
|
|
import { AuthResult } from '../models/domain/authResult';
|
|
import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey';
|
|
|
|
export abstract class AuthService {
|
|
email: string;
|
|
masterPasswordHash: string;
|
|
code: string;
|
|
codeVerifier: string;
|
|
ssoRedirectUrl: string;
|
|
clientId: string;
|
|
clientSecret: string;
|
|
twoFactorProvidersData: Map<TwoFactorProviderType, { [key: string]: string; }>;
|
|
selectedTwoFactorProviderType: TwoFactorProviderType;
|
|
|
|
logIn: (email: string, masterPassword: string) => Promise<AuthResult>;
|
|
logInSso: (code: string, codeVerifier: string, redirectUrl: string) => Promise<AuthResult>;
|
|
logInApiKey: (clientId: string, clientSecret: string) => Promise<AuthResult>;
|
|
logInTwoFactor: (twoFactorProvider: TwoFactorProviderType, twoFactorToken: string,
|
|
remember?: boolean) => Promise<AuthResult>;
|
|
logInComplete: (email: string, masterPassword: string, twoFactorProvider: TwoFactorProviderType,
|
|
twoFactorToken: string, remember?: boolean) => Promise<AuthResult>;
|
|
logInSsoComplete: (code: string, codeVerifier: string, redirectUrl: string,
|
|
twoFactorProvider: TwoFactorProviderType, twoFactorToken: string, remember?: boolean) => Promise<AuthResult>;
|
|
logInApiKeyComplete: (clientId: string, clientSecret: string, twoFactorProvider: TwoFactorProviderType,
|
|
twoFactorToken: string, remember?: boolean) => Promise<AuthResult>;
|
|
logOut: (callback: Function) => void;
|
|
getSupportedTwoFactorProviders: (win: Window) => any[];
|
|
getDefaultTwoFactorProvider: (u2fSupported: boolean) => TwoFactorProviderType;
|
|
makePreloginKey: (masterPassword: string, email: string) => Promise<SymmetricCryptoKey>;
|
|
authingWithApiKey: () => boolean;
|
|
authingWithSso: () => boolean;
|
|
authingWithPassword: () => boolean;
|
|
}
|