mirror of
https://github.com/bitwarden/browser
synced 2026-02-21 20:04:02 +00:00
key connector domain tests fix for sso componrnt and login strategy
This commit is contained in:
@@ -30,8 +30,8 @@ import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/sym
|
||||
import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/spec";
|
||||
import { CsprngArray } from "@bitwarden/common/types/csprng";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { DeviceKey, UserKey, MasterKey } from "@bitwarden/common/types/key";
|
||||
import { KdfConfigService, KeyService } from "@bitwarden/key-management";
|
||||
import { DeviceKey, MasterKey, UserKey } from "@bitwarden/common/types/key";
|
||||
import { KdfConfigService, KdfType, KeyService } from "@bitwarden/key-management";
|
||||
|
||||
import {
|
||||
AuthRequestServiceAbstraction,
|
||||
@@ -475,16 +475,23 @@ describe("SsoLoginStrategy", () => {
|
||||
|
||||
it("converts new SSO user with no master password to Key Connector on first login", async () => {
|
||||
tokenResponse.key = null;
|
||||
tokenResponse.kdf = KdfType.Argon2id;
|
||||
tokenResponse.kdfIterations = 10;
|
||||
tokenResponse.kdfMemory = 64;
|
||||
tokenResponse.kdfParallelism = 4;
|
||||
|
||||
apiService.postIdentityToken.mockResolvedValue(tokenResponse);
|
||||
|
||||
await ssoLoginStrategy.logIn(credentials);
|
||||
const result = await ssoLoginStrategy.logIn(credentials);
|
||||
|
||||
expect(keyConnectorService.convertNewSsoUserToKeyConnector).toHaveBeenCalledWith(
|
||||
tokenResponse,
|
||||
ssoOrgId,
|
||||
userId,
|
||||
);
|
||||
expect(result.requiresKeyConnectorDomainConfirmation).toEqual({
|
||||
organizationId: ssoOrgId,
|
||||
keyConnectorUrl: keyConnectorUrl,
|
||||
kdf: KdfType.Argon2id,
|
||||
kdfIterations: 10,
|
||||
kdfMemory: 64,
|
||||
kdfParallelism: 4,
|
||||
});
|
||||
});
|
||||
|
||||
it("decrypts and sets the user key if Key Connector is enabled and the user doesn't have a master password", async () => {
|
||||
@@ -531,16 +538,23 @@ describe("SsoLoginStrategy", () => {
|
||||
|
||||
it("converts new SSO user with no master password to Key Connector on first login", async () => {
|
||||
tokenResponse.key = null;
|
||||
tokenResponse.kdf = KdfType.Argon2id;
|
||||
tokenResponse.kdfIterations = 10;
|
||||
tokenResponse.kdfMemory = 64;
|
||||
tokenResponse.kdfParallelism = 4;
|
||||
|
||||
apiService.postIdentityToken.mockResolvedValue(tokenResponse);
|
||||
|
||||
await ssoLoginStrategy.logIn(credentials);
|
||||
const result = await ssoLoginStrategy.logIn(credentials);
|
||||
|
||||
expect(keyConnectorService.convertNewSsoUserToKeyConnector).toHaveBeenCalledWith(
|
||||
tokenResponse,
|
||||
ssoOrgId,
|
||||
userId,
|
||||
);
|
||||
expect(result.requiresKeyConnectorDomainConfirmation).toEqual({
|
||||
organizationId: ssoOrgId,
|
||||
keyConnectorUrl: keyConnectorUrl,
|
||||
kdf: KdfType.Argon2id,
|
||||
kdfIterations: 10,
|
||||
kdfMemory: 64,
|
||||
kdfParallelism: 4,
|
||||
});
|
||||
});
|
||||
|
||||
it("decrypts and sets the user key if Key Connector is enabled and the user doesn't have a master password", async () => {
|
||||
|
||||
Reference in New Issue
Block a user