From 80978abefc5511bef6eeee625cb4805e3964d5bf Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 4 Oct 2026 22:02:30 +0330 Subject: [PATCH] last ... --- Dtos/XApiKeyDto.cs | 74 +++++++++++++++++++++++++++++++++++++++++ Dtos/XApiKeyUsageDto.cs | 43 ++++++++++++++++++++++++ Dtos/XApplicationDto.cs | 49 +++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 Dtos/XApiKeyDto.cs create mode 100644 Dtos/XApiKeyUsageDto.cs create mode 100644 Dtos/XApplicationDto.cs diff --git a/Dtos/XApiKeyDto.cs b/Dtos/XApiKeyDto.cs new file mode 100644 index 0000000..1c2cbc1 --- /dev/null +++ b/Dtos/XApiKeyDto.cs @@ -0,0 +1,74 @@ +using System; +using xModels.Base; + +namespace xIdentityModels.Dtos +{ + /// + /// an Specified Api Key ... + /// + public class XApiKeyDto : XBaseGuidIDEntityDto + { + /// + /// Related Application Id ... + /// + public int ApplicationId { get; set; } + + /// + /// Hash ... + /// SHA256 of ApiKey ... + /// + public string KeyHash { get; set; } + + /// + /// a Prefix ... + /// + public string KeyPrefix { get; set; } + + /// + /// Expiration Type ... + /// + public DateTime ExpiresAt { get; set; } + + /// + /// Cration Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Last Usage Date ... + /// + public DateTime? LastUsedAt { get; set; } + + /// + /// Revoked Time ... + /// + public DateTime? RevokedAt { get; set; } + + /// + /// Revoker User Id ... + /// + public string RevokedBy { get; set; } + + /// + /// a Json Array String ... + /// XApiKeyScope ... + /// + public string AllowedScopes { get; set; } + + /// + /// a Comma-separated List which Specified White List IP ... + /// + public string AllowedIPs { get; set; } + + /// + /// Rate Limit Per Minute ... + /// + public int RateLimitPerMinute { get; set; } = 60; + + // + /// + /// Related Application ... + /// + public virtual XApplicationDto Application { get; set; } + } +} \ No newline at end of file diff --git a/Dtos/XApiKeyUsageDto.cs b/Dtos/XApiKeyUsageDto.cs new file mode 100644 index 0000000..dbdb030 --- /dev/null +++ b/Dtos/XApiKeyUsageDto.cs @@ -0,0 +1,43 @@ +using System; +using xModels.Base; + +namespace xIdentityModels.Dtos +{ + public class XApiKeyUsageDto : XBaseLongIDEntityDto + { + /// + /// Api Key Id ... + /// + public Guid ApiKeyId { get; set; } + + /// + /// Called Endpoint ... + /// + public string Endpoint { get; set; } + + /// + /// Called Http Method ... + /// + public string HttpMethod { get; set; } + + /// + /// Client IP Address ... + /// + public string ClientIP { get; set; } + + /// + /// Status Code ... + /// + public int StatusCode { get; set; } + + /// + /// Request Time ... + /// + public DateTime RequestedOn { get; set; } + + /// + /// Response Time in Milliseconds ... + /// + public long ResponseTimeMs { get; set; } + } +} \ No newline at end of file diff --git a/Dtos/XApplicationDto.cs b/Dtos/XApplicationDto.cs new file mode 100644 index 0000000..c757c49 --- /dev/null +++ b/Dtos/XApplicationDto.cs @@ -0,0 +1,49 @@ +using System; +using xModels.Base; +using xModels.Dtos; +using xIdentityModels.Constants; + +namespace xIdentityModels.Dtos +{ + /// + /// an Application in xDashboard ... + /// + public class XApplicationDto : XBaseIntIDEntityDto + { + /// + /// Name ... + /// + public string Name { get; set; } + + /// + /// Descriptor ... + /// + public string Description { get; set; } + + /// + /// Owner Id ... + /// + public string OwnerId { get; set; } + public virtual XPersonDto Owner { get; set; } + + /// + /// Application Type ... + /// + public XApplicationType Type { get; set; } + + /// + /// Specified Application is Active or not ... + /// + public bool IsActive { get; set; } = true; + + /// + /// Application Create Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Application Update Type ... + /// + public DateTime UpdatedAt { get; set; } + } +} \ No newline at end of file