From 5aaa42faa4f2b992508e305cf2cc6cbe32d4b45d Mon Sep 17 00:00:00 2001 From: iamshen Date: Fri, 17 May 2024 09:28:24 +0800 Subject: [PATCH] Update IdentityServer4 log entity namespace to logging --- DaprTool.Solution.sln | 92 +++++++++++++++++-- .../Dtos/Logging/AuditLogDto.cs | 61 ++++++++++++ .../Dtos/Logging/AuditLogFilterDto.cs | 22 +++++ .../Dtos/Logging/AuditLogsDto.cs | 21 +++++ .../Dtos/Logging/LogDto.cs | 25 +++++ .../Dtos/Logging/LogsDto.cs | 21 +++++ 6 files changed, 233 insertions(+), 9 deletions(-) create mode 100644 src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogDto.cs create mode 100644 src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogFilterDto.cs create mode 100644 src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogsDto.cs create mode 100644 src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogDto.cs create mode 100644 src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogsDto.cs diff --git a/DaprTool.Solution.sln b/DaprTool.Solution.sln index b1bfe8f..ab7b347 100644 --- a/DaprTool.Solution.sln +++ b/DaprTool.Solution.sln @@ -159,6 +159,34 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaprTool.Solution.AppHost", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaprTool.Solution.ServiceDefaults", "build\DaprTool.Solution.ServiceDefaults\DaprTool.Solution.ServiceDefaults.csproj", "{F2165039-0483-4149-BEB6-A40928C17D4E}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.BusinessLogic", "src\IdentityServer4\src\Idsrv4.Admin.BusinessLogic\Idsrv4.Admin.BusinessLogic.csproj", "{8DBF69E2-983F-41EA-B2BB-02AB7A668FA2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.BusinessLogic.Identity", "src\IdentityServer4\src\Idsrv4.Admin.BusinessLogic.Identity\Idsrv4.Admin.BusinessLogic.Identity.csproj", "{D370978B-931A-4DD4-AE24-CE07F6A9E190}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.BusinessLogic.Shared", "src\IdentityServer4\src\Idsrv4.Admin.BusinessLogic.Shared\Idsrv4.Admin.BusinessLogic.Shared.csproj", "{9C985145-E772-428B-9885-45B676D3EA78}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.EntityFramework", "src\IdentityServer4\src\Idsrv4.Admin.EntityFramework\Idsrv4.Admin.EntityFramework.csproj", "{463F0EA5-882F-4E42-85CA-D676CFAD24FB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.EntityFramework.Configuration", "src\IdentityServer4\src\Idsrv4.Admin.EntityFramework.Configuration\Idsrv4.Admin.EntityFramework.Configuration.csproj", "{0D8DF060-951C-4090-A20A-CE1E62B65D81}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.EntityFramework.Extensions", "src\IdentityServer4\src\Idsrv4.Admin.EntityFramework.Extensions\Idsrv4.Admin.EntityFramework.Extensions.csproj", "{93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.EntityFramework.Identity", "src\IdentityServer4\src\Idsrv4.Admin.EntityFramework.Identity\Idsrv4.Admin.EntityFramework.Identity.csproj", "{9F77AA52-E109-46E5-B3F6-434B0397C0C9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Idsrv4.Admin.Shared.Configuration", "src\IdentityServer4\src\Idsrv4.Admin.Shared.Configuration\Idsrv4.Admin.Shared.Configuration.csproj", "{08901097-7D7E-4A4F-ADC8-547C756B50EA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{1B3F7528-270E-4BE3-B1B4-038293EEA794}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "database", "database", "{FAF09FF7-4B68-4645-ABCE-B1024016E38E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "business", "business", "{4BD5A82F-3A5C-4CA2-976F-855BA3C51B11}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "auditLogging", "auditLogging", "{14D68EB5-39B8-45EC-89B4-60C661C5B2C6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sts", "sts", "{C27A08DD-CF84-4B1D-A276-82A19B86BD1C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{B76D6ACE-5EC8-49DC-BA37-ED479808FEDE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -309,6 +337,38 @@ Global {F2165039-0483-4149-BEB6-A40928C17D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {F2165039-0483-4149-BEB6-A40928C17D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2165039-0483-4149-BEB6-A40928C17D4E}.Release|Any CPU.Build.0 = Release|Any CPU + {8DBF69E2-983F-41EA-B2BB-02AB7A668FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DBF69E2-983F-41EA-B2BB-02AB7A668FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DBF69E2-983F-41EA-B2BB-02AB7A668FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DBF69E2-983F-41EA-B2BB-02AB7A668FA2}.Release|Any CPU.Build.0 = Release|Any CPU + {D370978B-931A-4DD4-AE24-CE07F6A9E190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D370978B-931A-4DD4-AE24-CE07F6A9E190}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D370978B-931A-4DD4-AE24-CE07F6A9E190}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D370978B-931A-4DD4-AE24-CE07F6A9E190}.Release|Any CPU.Build.0 = Release|Any CPU + {9C985145-E772-428B-9885-45B676D3EA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C985145-E772-428B-9885-45B676D3EA78}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C985145-E772-428B-9885-45B676D3EA78}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C985145-E772-428B-9885-45B676D3EA78}.Release|Any CPU.Build.0 = Release|Any CPU + {463F0EA5-882F-4E42-85CA-D676CFAD24FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {463F0EA5-882F-4E42-85CA-D676CFAD24FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {463F0EA5-882F-4E42-85CA-D676CFAD24FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {463F0EA5-882F-4E42-85CA-D676CFAD24FB}.Release|Any CPU.Build.0 = Release|Any CPU + {0D8DF060-951C-4090-A20A-CE1E62B65D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D8DF060-951C-4090-A20A-CE1E62B65D81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D8DF060-951C-4090-A20A-CE1E62B65D81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D8DF060-951C-4090-A20A-CE1E62B65D81}.Release|Any CPU.Build.0 = Release|Any CPU + {93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA}.Release|Any CPU.Build.0 = Release|Any CPU + {9F77AA52-E109-46E5-B3F6-434B0397C0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F77AA52-E109-46E5-B3F6-434B0397C0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F77AA52-E109-46E5-B3F6-434B0397C0C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F77AA52-E109-46E5-B3F6-434B0397C0C9}.Release|Any CPU.Build.0 = Release|Any CPU + {08901097-7D7E-4A4F-ADC8-547C756B50EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08901097-7D7E-4A4F-ADC8-547C756B50EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08901097-7D7E-4A4F-ADC8-547C756B50EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08901097-7D7E-4A4F-ADC8-547C756B50EA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -360,19 +420,33 @@ Global {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} {306E933B-914F-4935-A924-DA756F766753} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} {EA794699-4DD1-4622-A80F-DB138AB53D86} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} - {69BAC3F6-575C-49C6-B51C-2C198178BC85} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {B28F0B35-FA5E-4FCA-89E4-87DF29DEEC71} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {D1A7D06B-09B9-459B-B443-259E6BCF3E27} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {03A34FBE-B8ED-4D47-8BF0-3AD55FDD9E85} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {297596B1-296D-47C7-A4A4-0C1C25A347F2} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {AB633ACE-EB70-4ABB-AE2C-07C893EFD1C0} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {3A8C58F1-027A-4B82-BEFF-AA82383AE8D7} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {36A1CAB5-53B0-46E2-A083-DD3CA9E08BB1} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} - {07E8E5C4-DA82-44DD-B526-6A4150D5C9FD} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {69BAC3F6-575C-49C6-B51C-2C198178BC85} = {1B3F7528-270E-4BE3-B1B4-038293EEA794} + {B28F0B35-FA5E-4FCA-89E4-87DF29DEEC71} = {C27A08DD-CF84-4B1D-A276-82A19B86BD1C} + {D1A7D06B-09B9-459B-B443-259E6BCF3E27} = {1B3F7528-270E-4BE3-B1B4-038293EEA794} + {03A34FBE-B8ED-4D47-8BF0-3AD55FDD9E85} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {297596B1-296D-47C7-A4A4-0C1C25A347F2} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {AB633ACE-EB70-4ABB-AE2C-07C893EFD1C0} = {B76D6ACE-5EC8-49DC-BA37-ED479808FEDE} + {3A8C58F1-027A-4B82-BEFF-AA82383AE8D7} = {14D68EB5-39B8-45EC-89B4-60C661C5B2C6} + {36A1CAB5-53B0-46E2-A083-DD3CA9E08BB1} = {14D68EB5-39B8-45EC-89B4-60C661C5B2C6} + {07E8E5C4-DA82-44DD-B526-6A4150D5C9FD} = {1B3F7528-270E-4BE3-B1B4-038293EEA794} {60ABC20F-873F-4DA3-A86B-DAA5B563A2B5} = {5724FC31-E7B7-4F84-8B04-85E8A7B964DB} {E8CEAD9D-B4BF-4ED1-9DA6-ABC41E797D60} = {60ABC20F-873F-4DA3-A86B-DAA5B563A2B5} {639EAAE4-2DCB-41AD-A912-248F3FEA6B5E} = {B4373E4B-C419-4D3D-8A52-2A07AF906D0F} {F2165039-0483-4149-BEB6-A40928C17D4E} = {B4373E4B-C419-4D3D-8A52-2A07AF906D0F} + {8DBF69E2-983F-41EA-B2BB-02AB7A668FA2} = {4BD5A82F-3A5C-4CA2-976F-855BA3C51B11} + {D370978B-931A-4DD4-AE24-CE07F6A9E190} = {4BD5A82F-3A5C-4CA2-976F-855BA3C51B11} + {9C985145-E772-428B-9885-45B676D3EA78} = {4BD5A82F-3A5C-4CA2-976F-855BA3C51B11} + {463F0EA5-882F-4E42-85CA-D676CFAD24FB} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {0D8DF060-951C-4090-A20A-CE1E62B65D81} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {93FBD9DF-4E36-431D-97F4-5CF9C6ED15EA} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {9F77AA52-E109-46E5-B3F6-434B0397C0C9} = {FAF09FF7-4B68-4645-ABCE-B1024016E38E} + {08901097-7D7E-4A4F-ADC8-547C756B50EA} = {B76D6ACE-5EC8-49DC-BA37-ED479808FEDE} + {1B3F7528-270E-4BE3-B1B4-038293EEA794} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {FAF09FF7-4B68-4645-ABCE-B1024016E38E} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {4BD5A82F-3A5C-4CA2-976F-855BA3C51B11} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {14D68EB5-39B8-45EC-89B4-60C661C5B2C6} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {C27A08DD-CF84-4B1D-A276-82A19B86BD1C} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} + {B76D6ACE-5EC8-49DC-BA37-ED479808FEDE} = {D2F20A9C-E732-43EA-9615-70F9FD46253A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CE377903-BDA1-4347-BEC2-62ED2F807EE3} diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogDto.cs b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogDto.cs new file mode 100644 index 0000000..70790e9 --- /dev/null +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogDto.cs @@ -0,0 +1,61 @@ +using System; + +namespace Idsrv4.Admin.BusinessLogic.Dtos.Log; + +public class AuditLogDto +{ + /// + /// Unique identifier for event + /// + public long Id { get; set; } + + /// + /// Event name + /// + public string Event { get; set; } + + /// + /// Source of logging events + /// + public string Source { get; set; } + + /// + /// Event category + /// + public string Category { get; set; } + + /// + /// Subject Identifier - who is responsible for current action + /// + public string SubjectIdentifier { get; set; } + + /// + /// Subject Name - who is responsible for current action + /// + public string SubjectName { get; set; } + + /// + /// Subject Type - User/Machine + /// + public string SubjectType { get; set; } + + /// + /// Subject - some additional data + /// + public string SubjectAdditionalData { get; set; } + + /// + /// Information about request/action + /// + public string Action { get; set; } + + /// + /// Data which are serialized into JSON format + /// + public string Data { get; set; } + + /// + /// Date and time for creating of the event + /// + public DateTime Created { get; set; } +} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogFilterDto.cs b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogFilterDto.cs new file mode 100644 index 0000000..c8a3969 --- /dev/null +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogFilterDto.cs @@ -0,0 +1,22 @@ +using System; + +namespace Idsrv4.Admin.BusinessLogic.Dtos.Log; + +public class AuditLogFilterDto +{ + public string Event { get; set; } + + public string Source { get; set; } + + public string Category { get; set; } + + public DateTime? Created { get; set; } + + public string SubjectIdentifier { get; set; } + + public string SubjectName { get; set; } + + public int PageSize { get; set; } = 10; + + public int Page { get; set; } = 1; +} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogsDto.cs b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogsDto.cs new file mode 100644 index 0000000..cc5fb2b --- /dev/null +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/AuditLogsDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Idsrv4.Admin.BusinessLogic.Dtos.Log; + +public class AuditLogsDto +{ + public AuditLogsDto() + { + Logs = new List(); + } + + [Required] public DateTime? DeleteOlderThan { get; set; } + + public List Logs { get; set; } + + public int TotalCount { get; set; } + + public int PageSize { get; set; } +} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogDto.cs b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogDto.cs new file mode 100644 index 0000000..015cbca --- /dev/null +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogDto.cs @@ -0,0 +1,25 @@ +using System; +using System.Xml.Linq; + +namespace Idsrv4.Admin.BusinessLogic.Dtos.Log; + +public class LogDto +{ + public long Id { get; set; } + + public string Message { get; set; } + + public string MessageTemplate { get; set; } + + public string Level { get; set; } + + public DateTimeOffset TimeStamp { get; set; } + + public string Exception { get; set; } + + public string LogEvent { get; set; } + + public string Properties { get; set; } + + public XElement PropertiesXml => XElement.Parse(Properties); +} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogsDto.cs b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogsDto.cs new file mode 100644 index 0000000..63d22d6 --- /dev/null +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Dtos/Logging/LogsDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Idsrv4.Admin.BusinessLogic.Dtos.Log; + +public class LogsDto +{ + public LogsDto() + { + Logs = new List(); + } + + [Required] public DateTime? DeleteOlderThan { get; set; } + + public List Logs { get; set; } + + public int TotalCount { get; set; } + + public int PageSize { get; set; } +} \ No newline at end of file -- Gitee