1
0
mirror of https://github.com/bitwarden/server synced 2025-12-29 06:33:43 +00:00

[PM-18239] Master password policy requirement (#5936)

* wip

* initial implementation

* add tests

* more tests, fix policy Enabled

* remove exempt statuses

* test EnforcedOptions is populated

* clean up, add test

* fix test, add json attributes for deserialization

* fix attribute casing

* fix test

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
Brandon Treston
2025-07-25 10:14:16 -04:00
committed by GitHub
parent c503ecbefc
commit 571111e897
6 changed files with 207 additions and 10 deletions

View File

@@ -1,20 +1,28 @@
namespace Bit.Core.AdminConsole.Models.Data.Organizations.Policies;
using System.Text.Json.Serialization;
namespace Bit.Core.AdminConsole.Models.Data.Organizations.Policies;
public class MasterPasswordPolicyData : IPolicyDataModel
{
[JsonPropertyName("minComplexity")]
public int? MinComplexity { get; set; }
[JsonPropertyName("minLength")]
public int? MinLength { get; set; }
[JsonPropertyName("requireLower")]
public bool? RequireLower { get; set; }
[JsonPropertyName("requireUpper")]
public bool? RequireUpper { get; set; }
[JsonPropertyName("requireNumbers")]
public bool? RequireNumbers { get; set; }
[JsonPropertyName("requireSpecial")]
public bool? RequireSpecial { get; set; }
[JsonPropertyName("enforceOnLogin")]
public bool? EnforceOnLogin { get; set; }
/// <summary>
/// Combine the other policy data with this instance, taking the most secure options
/// </summary>
/// <param name="other">The other policy instance to combine with this</param>
public void CombineWith(MasterPasswordPolicyData other)
public void CombineWith(MasterPasswordPolicyData? other)
{
if (other == null)
{