mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[PS 1045] bw login with apikey argument fails on cli (#3959)
* Add fix for bw login with apikey argument fails bug * Changes after running the prettier * Revert chnages on the launch.json file * Changes after running a lint * Renaming a filename to remove capital letters * Resolving the error on test run * Renaming file names due lint errors * Renaming new files to conform to snake case * Remove the test for user api login strategy * Adding the user api login test and file renaming * Rename file name to organization-api-login.spec.ts * Fixing the lint error on PR * Adding the apiLogIn.strategy to whitelist-capital-letters * Removing all the apiLogIn.strategy in whitelist-capital-letters. * Fixing PR comment relating OrganizationApiTokenRequest * Resolve PR comment on OrganizationApiTokenRequest model * Fixing PR comment of separating organization token model * fixing the lint error message * Fixing the lint error * Reverting the changes on lunch.js * revert the actual content on launch.json * Reverting changes relating to organization api login * Removing the OrganizationIdentityTokenResponse file * Removing OrganizationIdentityTokenResponse file Co-authored-by: dynwee <onwudiweokeke@gmail.com>
This commit is contained in:
@@ -11,23 +11,23 @@ import { TwoFactorProviderType } from "../../enums/twoFactorProviderType";
|
||||
import { Account, AccountProfile, AccountTokens } from "../../models/domain/account";
|
||||
import { AuthResult } from "../../models/domain/auth-result";
|
||||
import {
|
||||
ApiLogInCredentials,
|
||||
UserApiLogInCredentials,
|
||||
PasswordLogInCredentials,
|
||||
SsoLogInCredentials,
|
||||
PasswordlessLogInCredentials,
|
||||
} from "../../models/domain/log-in-credentials";
|
||||
import { DeviceRequest } from "../../models/request/device.request";
|
||||
import { ApiTokenRequest } from "../../models/request/identity-token/api-token.request";
|
||||
import { PasswordTokenRequest } from "../../models/request/identity-token/password-token.request";
|
||||
import { SsoTokenRequest } from "../../models/request/identity-token/sso-token.request";
|
||||
import { TokenTwoFactorRequest } from "../../models/request/identity-token/token-two-factor.request";
|
||||
import { UserApiTokenRequest } from "../../models/request/identity-token/user-api-token.request";
|
||||
import { KeysRequest } from "../../models/request/keys.request";
|
||||
import { IdentityCaptchaResponse } from "../../models/response/identity-captcha.response";
|
||||
import { IdentityTokenResponse } from "../../models/response/identity-token.response";
|
||||
import { IdentityTwoFactorResponse } from "../../models/response/identity-two-factor.response";
|
||||
|
||||
export abstract class LogInStrategy {
|
||||
protected abstract tokenRequest: ApiTokenRequest | PasswordTokenRequest | SsoTokenRequest;
|
||||
protected abstract tokenRequest: UserApiTokenRequest | PasswordTokenRequest | SsoTokenRequest;
|
||||
protected captchaBypassToken: string = null;
|
||||
|
||||
constructor(
|
||||
@@ -44,7 +44,7 @@ export abstract class LogInStrategy {
|
||||
|
||||
abstract logIn(
|
||||
credentials:
|
||||
| ApiLogInCredentials
|
||||
| UserApiLogInCredentials
|
||||
| PasswordLogInCredentials
|
||||
| SsoLogInCredentials
|
||||
| PasswordlessLogInCredentials
|
||||
|
||||
@@ -9,14 +9,14 @@ import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
||||
import { StateService } from "../../abstractions/state.service";
|
||||
import { TokenService } from "../../abstractions/token.service";
|
||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
||||
import { ApiLogInCredentials } from "../../models/domain/log-in-credentials";
|
||||
import { ApiTokenRequest } from "../../models/request/identity-token/api-token.request";
|
||||
import { UserApiLogInCredentials } from "../../models/domain/log-in-credentials";
|
||||
import { UserApiTokenRequest } from "../../models/request/identity-token/user-api-token.request";
|
||||
import { IdentityTokenResponse } from "../../models/response/identity-token.response";
|
||||
|
||||
import { LogInStrategy } from "./logIn.strategy";
|
||||
|
||||
export class ApiLogInStrategy extends LogInStrategy {
|
||||
tokenRequest: ApiTokenRequest;
|
||||
export class UserApiLogInStrategy extends LogInStrategy {
|
||||
tokenRequest: UserApiTokenRequest;
|
||||
|
||||
constructor(
|
||||
cryptoService: CryptoService,
|
||||
@@ -51,8 +51,8 @@ export class ApiLogInStrategy extends LogInStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
async logIn(credentials: ApiLogInCredentials) {
|
||||
this.tokenRequest = new ApiTokenRequest(
|
||||
async logIn(credentials: UserApiLogInCredentials) {
|
||||
this.tokenRequest = new UserApiTokenRequest(
|
||||
credentials.clientId,
|
||||
credentials.clientSecret,
|
||||
await this.buildTwoFactor(),
|
||||
Reference in New Issue
Block a user