mirror of
https://github.com/bitwarden/server.git
synced 2025-06-07 11:40:31 -05:00
Updated LicenseIgnore to target Signature instead of Hash
This commit is contained in:
parent
598259a785
commit
eefc1a2e58
@ -1,12 +1,12 @@
|
||||
namespace Bit.Core.Billing.Licenses.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class LicenseIgnoreAttribute(bool includeInHash = true) : Attribute
|
||||
public class LicenseIgnoreAttribute(bool includeInSignature = false) : Attribute
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// If true, the property will be included when computing the license hash, but ignored for other operations.
|
||||
/// If false, the property will be completely ignored including for hash computation.
|
||||
/// If true, the property will be included when computing the license signature, but ignored for other operations.
|
||||
/// If false, the property will be completely ignored including for signature computation.
|
||||
/// </summary>
|
||||
public bool IncludeInHash { get; } = includeInHash;
|
||||
public bool IncludeInSignature { get; } = includeInSignature;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public static class LicenseExtensions
|
||||
return true;
|
||||
}
|
||||
|
||||
return forHash && ignoreAttr.IncludeInHash;
|
||||
return !forHash && ignoreAttr.IncludeInSignature;
|
||||
})
|
||||
.OrderBy(p => p.Name)
|
||||
.Select(p => $"{p.Name}:{CoreHelpers.FormatLicenseSignatureValue(p.GetValue(license, null))}")
|
||||
|
@ -12,14 +12,14 @@ public abstract class BaseLicense : ILicense
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
[LicenseIgnore(includeInHash: false)]
|
||||
[LicenseIgnore(includeInSignature: true)]
|
||||
public DateTime Issued { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
public DateTime? Expires { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
[LicenseIgnore(includeInHash: false)]
|
||||
[LicenseIgnore(includeInSignature: true)]
|
||||
public DateTime? Refresh { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
@ -35,11 +35,11 @@ public abstract class BaseLicense : ILicense
|
||||
public string Name { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
[LicenseIgnore(includeInHash: false)]
|
||||
[LicenseIgnore(includeInSignature: true)]
|
||||
public string Hash { get; set; }
|
||||
|
||||
[LicenseVersion(1)]
|
||||
[LicenseIgnore(includeInHash: false)]
|
||||
[LicenseIgnore]
|
||||
public string Signature { get; set; }
|
||||
|
||||
[LicenseIgnore]
|
||||
|
Loading…
x
Reference in New Issue
Block a user