From aa43c41289ff5d8f9621f71312b66c64b9ee5784 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Tue, 15 Sep 2020 10:20:26 +0800 Subject: [PATCH 1/2] Add security log document. Resolve #4794 --- docs/en/Modules/Identity.md | 23 +++++++++++++++++++++++ docs/zh-Hans/Modules/Identity.md | 25 ++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/en/Modules/Identity.md b/docs/en/Modules/Identity.md index b950658505..b1e8e0efcc 100644 --- a/docs/en/Modules/Identity.md +++ b/docs/en/Modules/Identity.md @@ -4,3 +4,26 @@ Identity module is used to manage [organization units](Organization-Units.md), r See [the source code](https://github.com/abpframework/abp/tree/dev/modules/identity). Documentation will come soon... + +## Identity Security Log + +The security log can record some important operations or changes about your account. You can save the security log if needed. + +You can inject and use `IdentitySecurityLogManager` or `ISecurityLogManager` to write security logs. It will create a log object by default and fill in some common values, such as `CreationTime`, `ClientIpAddress`, `BrowserInfo`, `current user/tenant`, etc. Of course, you can override them. + +```cs +await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() +{ + Identity = "IdentityServer"; + Action = "ChangePassword"; +}); +``` + +Configure `AbpSecurityLogOptions `to provide the application name for the log or disable this feature. **enabed** by default. + +```cs +Configure(options => +{ + options.ApplicationName = "AbpSecurityTest"; +}); +``` diff --git a/docs/zh-Hans/Modules/Identity.md b/docs/zh-Hans/Modules/Identity.md index f396de00c1..4332e3b807 100644 --- a/docs/zh-Hans/Modules/Identity.md +++ b/docs/zh-Hans/Modules/Identity.md @@ -2,4 +2,27 @@ 身份模块基于Microsoft Identity 库用于管理[组织单元](Organization-Units.md), 角色, 用户和他们的权限. -参阅 [源码](https://github.com/abpframework/abp/tree/dev/modules/identity). 文档很快会被完善. \ No newline at end of file +参阅 [源码](https://github.com/abpframework/abp/tree/dev/modules/identity). 文档很快会被完善. + +## Identity安全日志 + +安全日志可以记录账户的一些重要的操作或者改动, 你可以在在一些功能中保存安全日志. + +你可以注入和使用 `IdentitySecurityLogManager` 或`ISecurityLogManager` 来保存安全日志. 默认它会创建一个安全日志对象并填充常用的值. 如 `CreationTime`, `ClientIpAddress`, `BrowserInfo`, `current user/tenant`等等. 当然你可以自定义这些值. + +```cs +await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() +{ + Identity = "IdentityServer"; + Action = "ChangePassword"; +}); +``` + +通过配置 `AbpSecurityLogOptions `来提供应用程序的名称或者禁用安全日志功能. 默认是启用状态. + +```cs +Configure(options => +{ + options.ApplicationName = "AbpSecurityTest"; +}); +``` From 6f2f19a32c5917dc5721e3109e6629b21c32a3af Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 15 Sep 2020 10:30:04 +0800 Subject: [PATCH 2/2] format security log document --- docs/en/Modules/Identity.md | 2 +- docs/zh-Hans/Modules/Identity.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/Modules/Identity.md b/docs/en/Modules/Identity.md index b1e8e0efcc..ac86b13564 100644 --- a/docs/en/Modules/Identity.md +++ b/docs/en/Modules/Identity.md @@ -19,7 +19,7 @@ await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() }); ``` -Configure `AbpSecurityLogOptions `to provide the application name for the log or disable this feature. **enabed** by default. +Configure `AbpSecurityLogOptions` to provide the application name for the log or disable this feature. **Enabled** by default. ```cs Configure(options => diff --git a/docs/zh-Hans/Modules/Identity.md b/docs/zh-Hans/Modules/Identity.md index 4332e3b807..5589fb367e 100644 --- a/docs/zh-Hans/Modules/Identity.md +++ b/docs/zh-Hans/Modules/Identity.md @@ -1,6 +1,6 @@ # 身份管理模块 -身份模块基于Microsoft Identity 库用于管理[组织单元](Organization-Units.md), 角色, 用户和他们的权限. +身份模块基于Microsoft Identity库用于管理[组织单元](Organization-Units.md), 角色, 用户和他们的权限. 参阅 [源码](https://github.com/abpframework/abp/tree/dev/modules/identity). 文档很快会被完善. @@ -8,7 +8,7 @@ 安全日志可以记录账户的一些重要的操作或者改动, 你可以在在一些功能中保存安全日志. -你可以注入和使用 `IdentitySecurityLogManager` 或`ISecurityLogManager` 来保存安全日志. 默认它会创建一个安全日志对象并填充常用的值. 如 `CreationTime`, `ClientIpAddress`, `BrowserInfo`, `current user/tenant`等等. 当然你可以自定义这些值. +你可以注入和使用 `IdentitySecurityLogManager` 或 `ISecurityLogManager` 来保存安全日志. 默认它会创建一个安全日志对象并填充常用的值. 如 `CreationTime`, `ClientIpAddress`, `BrowserInfo`, `current user/tenant`等等. 当然你可以自定义这些值. ```cs await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() @@ -18,7 +18,7 @@ await IdentitySecurityLogManager.SaveAsync(new IdentitySecurityLogContext() }); ``` -通过配置 `AbpSecurityLogOptions `来提供应用程序的名称或者禁用安全日志功能. 默认是启用状态. +通过配置 `AbpSecurityLogOptions` 来提供应用程序的名称或者禁用安全日志功能. 默认是**启用**状态. ```cs Configure(options =>