Files
OpenWarehouse/OpenWarehouse.warehouse.api/Data/ClaimBase.cs
T
2025-02-26 23:42:19 +01:00

30 lines
782 B
C#

using System.ComponentModel.DataAnnotations.Schema;
using Claim = System.Security.Claims.Claim;
namespace OpenWarehouse.warehouse.api.Data;
public class ClaimBase
{
[Required]
public string? ClaimType { get; set; }
[Required]
public string? ClaimValue { get; set; }
public string? ClaimIssuer { get; set; }
[NotMapped]
public Claim Claim {
get
{
return new Claim(ClaimType ?? throw new Exception("Null exemption")
, ClaimValue ?? throw new Exception("Null exemption")
, ClaimIssuer ?? "Local");
}
set
{
ClaimType = value.Type;
ClaimValue = value.Value;
ClaimIssuer = value.Issuer;
}
}
}