using System.Security.Claims;
namespace ZeroFramework.IdentityServer.API.IdentityStores
{
///
/// Represents a claim that is granted to all users within a tenant.
///
/// The type of the primary key of the tenant associated with this claim.
public class IdentityTenantClaim
{
///
/// Gets or sets the identifier for this tenant claim.
///
public virtual int Id { get; set; }
///
/// Gets or sets the of the primary key of the tenant associated with this claim.
///
public virtual Guid TenantId { get; set; }
///
/// Gets or sets the claim type for this claim.
///
public virtual string ClaimType { get; set; } = string.Empty;
///
/// Gets or sets the claim value for this claim.
///
public virtual string? ClaimValue { get; set; }
///
/// Constructs a new claim with the type and value.
///
/// The that was produced.
public virtual Claim? ToClaim()
{
return ClaimType is not null ? new Claim(ClaimType, ClaimValue!) : null;
}
///
/// Initializes by copying ClaimType and ClaimValue from the other claim.
///
/// The claim to initialize from.
public virtual void InitializeFromClaim(Claim other)
{
ClaimType = other?.Type ?? string.Empty;
ClaimValue = other?.Value;
}
}
}