mirror of
https://github.com/bitwarden/server
synced 2025-12-23 19:53:40 +00:00
refactor(IdentityTokenResponse): [Auth/PM-3287] Remove deprecated resetMasterPassword property from IdentityTokenResponse (#6676)
This commit is contained in:
@@ -671,7 +671,6 @@ public abstract class BaseRequestValidator<T> where T : class
|
|||||||
|
|
||||||
customResponse.Add("MasterPasswordPolicy", await GetMasterPasswordPolicyAsync(user));
|
customResponse.Add("MasterPasswordPolicy", await GetMasterPasswordPolicyAsync(user));
|
||||||
customResponse.Add("ForcePasswordReset", user.ForcePasswordReset);
|
customResponse.Add("ForcePasswordReset", user.ForcePasswordReset);
|
||||||
customResponse.Add("ResetMasterPassword", string.IsNullOrWhiteSpace(user.MasterPassword));
|
|
||||||
customResponse.Add("Kdf", (byte)user.Kdf);
|
customResponse.Add("Kdf", (byte)user.Kdf);
|
||||||
customResponse.Add("KdfIterations", user.KdfIterations);
|
customResponse.Add("KdfIterations", user.KdfIterations);
|
||||||
customResponse.Add("KdfMemory", user.KdfMemory);
|
customResponse.Add("KdfMemory", user.KdfMemory);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Bit.Core;
|
|||||||
using Bit.Core.AdminConsole.OrganizationFeatures.Policies;
|
using Bit.Core.AdminConsole.OrganizationFeatures.Policies;
|
||||||
using Bit.Core.AdminConsole.Services;
|
using Bit.Core.AdminConsole.Services;
|
||||||
using Bit.Core.Auth.IdentityServer;
|
using Bit.Core.Auth.IdentityServer;
|
||||||
using Bit.Core.Auth.Models.Api.Response;
|
|
||||||
using Bit.Core.Auth.Repositories;
|
using Bit.Core.Auth.Repositories;
|
||||||
using Bit.Core.Context;
|
using Bit.Core.Context;
|
||||||
using Bit.Core.Entities;
|
using Bit.Core.Entities;
|
||||||
@@ -155,23 +154,7 @@ public class CustomTokenRequestValidator : BaseRequestValidator<CustomTokenReque
|
|||||||
{
|
{
|
||||||
// KeyConnectorUrl is configured in the CLI client, we just need to tell the client to use it
|
// KeyConnectorUrl is configured in the CLI client, we just need to tell the client to use it
|
||||||
context.Result.CustomResponse["ApiUseKeyConnector"] = true;
|
context.Result.CustomResponse["ApiUseKeyConnector"] = true;
|
||||||
context.Result.CustomResponse["ResetMasterPassword"] = false;
|
|
||||||
}
|
}
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Key connector data should have already been set in the decryption options
|
|
||||||
// for backwards compatibility we set them this way too. We can eventually get rid of this once we clean up
|
|
||||||
// ResetMasterPassword
|
|
||||||
if (!context.Result.CustomResponse.TryGetValue("UserDecryptionOptions", out var userDecryptionOptionsObj) ||
|
|
||||||
userDecryptionOptionsObj is not UserDecryptionOptions userDecryptionOptions)
|
|
||||||
{
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userDecryptionOptions is { KeyConnectorOption: { } })
|
|
||||||
{
|
|
||||||
context.Result.CustomResponse["ResetMasterPassword"] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ public class IdentityServerTests : IClassFixture<IdentityApplicationFactory>
|
|||||||
var root = body.RootElement;
|
var root = body.RootElement;
|
||||||
AssertRefreshTokenExists(root);
|
AssertRefreshTokenExists(root);
|
||||||
AssertHelper.AssertJsonProperty(root, "ForcePasswordReset", JsonValueKind.False);
|
AssertHelper.AssertJsonProperty(root, "ForcePasswordReset", JsonValueKind.False);
|
||||||
AssertHelper.AssertJsonProperty(root, "ResetMasterPassword", JsonValueKind.False);
|
|
||||||
var kdf = AssertHelper.AssertJsonProperty(root, "Kdf", JsonValueKind.Number).GetInt32();
|
var kdf = AssertHelper.AssertJsonProperty(root, "Kdf", JsonValueKind.Number).GetInt32();
|
||||||
Assert.Equal(0, kdf);
|
Assert.Equal(0, kdf);
|
||||||
var kdfIterations = AssertHelper.AssertJsonProperty(root, "KdfIterations", JsonValueKind.Number).GetInt32();
|
var kdfIterations = AssertHelper.AssertJsonProperty(root, "KdfIterations", JsonValueKind.Number).GetInt32();
|
||||||
|
|||||||
Reference in New Issue
Block a user