// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Security.Claims;
namespace Microsoft.AspNetCore.Identity
{
///
/// Represents a claim that a user possesses.
///
/// The type used for the primary key for this user that possesses this claim.
public class IdentityUserClaim where TKey : IEquatable
{
///
/// Gets or sets the identifier for this user claim.
///
public virtual int Id { get; set; }
///
/// Gets or sets the primary key of the user associated with this claim.
///
public virtual TKey UserId { get; set; }
///
/// Gets or sets the claim type for this claim.
///
public virtual string ClaimType { get; set; }
///
/// Gets or sets the claim value for this claim.
///
public virtual string ClaimValue { get; set; }
///
/// Converts the entity into a Claim instance.
///
///
public virtual Claim ToClaim()
{
return new Claim(ClaimType, ClaimValue);
}
///
/// Reads the type and value from the Claim.
///
///
public virtual void InitializeFromClaim(Claim claim)
{
ClaimType = claim.Type;
ClaimValue = claim.Value;
}
}
}