mirror of
https://github.com/bitwarden/server
synced 2026-02-16 16:59:03 +00:00
fix(register): [PM-27084] Account Register Uses New Data Types - Removed invalid check.
This commit is contained in:
@@ -113,9 +113,6 @@ public class RegisterFinishRequestModel : IValidatableObject
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
// PM-28143 - Remove line below
|
||||
MasterPasswordUnlockDataRequestModel.ThrowIfExistsAndNotMatchingAuthenticationData(MasterPasswordAuthentication, MasterPasswordUnlock);
|
||||
|
||||
// PM-28143 - Remove line below
|
||||
MasterPasswordAuthenticationDataRequestModel.ThrowIfExistsAndHashIsNotEqual(MasterPasswordAuthentication, MasterPasswordHash);
|
||||
|
||||
|
||||
@@ -19,31 +19,4 @@ public class MasterPasswordUnlockDataRequestModel
|
||||
Salt = Salt
|
||||
};
|
||||
}
|
||||
|
||||
public static void ThrowIfExistsAndNotMatchingAuthenticationData(
|
||||
MasterPasswordAuthenticationDataRequestModel? authenticationData,
|
||||
MasterPasswordUnlockDataRequestModel? unlockData)
|
||||
{
|
||||
if (unlockData != null && authenticationData != null)
|
||||
{
|
||||
var matches = MatchesAuthenticationData(
|
||||
unlockData,
|
||||
authenticationData);
|
||||
|
||||
if (!matches)
|
||||
{
|
||||
throw new Exception("KDF settings and salt must match between authentication and unlock data.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool MatchesAuthenticationData(
|
||||
MasterPasswordUnlockDataRequestModel unlockData,
|
||||
MasterPasswordAuthenticationDataRequestModel authenticationData)
|
||||
{
|
||||
var kdfMatches = unlockData.Kdf.Equals(authenticationData.Kdf);
|
||||
var saltMatches = unlockData.Salt == authenticationData.Salt;
|
||||
|
||||
return kdfMatches && saltMatches;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,6 @@ using Bit.Core.Exceptions;
|
||||
|
||||
namespace Bit.Core.KeyManagement.Models.Data;
|
||||
|
||||
/// <summary>
|
||||
/// The data used for authentication of a master password.
|
||||
///
|
||||
/// This data model does not have any validation, consider using MasterPasswordAuthenticationDataRequestModel
|
||||
/// if validation is required.
|
||||
/// </summary>
|
||||
public class MasterPasswordAuthenticationData
|
||||
{
|
||||
public required KdfSettings Kdf { get; init; }
|
||||
|
||||
Reference in New Issue
Block a user