84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using System;
|
|
using xModels.Base;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace xIdentityModels.Models
|
|
{
|
|
/// <summary>
|
|
/// an Specified Api Key ...
|
|
/// </summary>
|
|
public class XApiKey : XBaseGuidIDEntity
|
|
{
|
|
/// <summary>
|
|
/// Related Application Id ...
|
|
/// </summary>
|
|
[Required]
|
|
public int ApplicationId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Hash ...
|
|
/// SHA256 of ApiKey ...
|
|
/// </summary>
|
|
[Required]
|
|
[StringLength(512)]
|
|
public string KeyHash { get; set; }
|
|
|
|
/// <summary>
|
|
/// a Prefix ...
|
|
/// </summary>
|
|
[StringLength(100)]
|
|
public string KeyPrefix { get; set; }
|
|
|
|
/// <summary>
|
|
/// Expiration Type ...
|
|
/// </summary>
|
|
[Required]
|
|
public DateTime ExpiresAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Cration Time ...
|
|
/// </summary>
|
|
public DateTime CreatedOn { get; set; }
|
|
|
|
/// <summary>
|
|
/// Last Usage Date ...
|
|
/// </summary>
|
|
public DateTime? LastUsedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Revoked Time ...
|
|
/// </summary>
|
|
public DateTime? RevokedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Revoker User Id ...
|
|
/// </summary>
|
|
public string RevokedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// a Json Array String ...
|
|
/// XApiKeyScope ...
|
|
/// </summary>
|
|
[StringLength(1000)]
|
|
public string AllowedScopes { get; set; }
|
|
|
|
/// <summary>
|
|
/// a Comma-separated List which Specified White List IP ...
|
|
/// </summary>
|
|
[StringLength(2000)]
|
|
public string AllowedIPs { get; set; }
|
|
|
|
/// <summary>
|
|
/// Rate Limit Per Minute ...
|
|
/// </summary>
|
|
public int RateLimitPerMinute { get; set; } = 60;
|
|
|
|
//
|
|
#region Navigation ...
|
|
/// <summary>
|
|
/// Related Application ...
|
|
/// </summary>
|
|
public virtual XApplication Application { get; set; }
|
|
#endregion
|
|
}
|
|
} |