`IdentityOptions`is the standard [options class](../Options.md) provided by the Microsoft [Identity library](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity). So, you can set these options in the `ConfigureServices` method of your [module](../Module-Development-Basics.md) class.
ABP takes these options one step further and allows you to change them on runtime by using the [setting system](../Settings.md). You can [inject](../Dependency-Injection.md) `ISettingManager`and use one of the `Set...` methods to change the option values for a user, a tenant or globally for all users.
**Example: Get notified when a new user has been created**
**例如: 当一个新用户被创建时接收通知**
````csharp
public class MyHandler :
@ -181,57 +181,57 @@ public class MyHandler :
}
````
`UserEto`and `IdentityRoleEto` are configured to automatically publish the events. You should configure yourself for the others. See the [Distributed Event Bus document](../Distributed-Event-Bus.md) to learn details of the pre-defined events.
> Subscribing to the distributed events is especially useful for distributed scenarios (like microservice architecture). If you are building a monolithic application, or listening events in the same process that runs the Identity Module, then subscribing to the [local events](../Local-Event-Bus.md) can be more efficient and easier.
This section covers some internal details of the module that you don't need much, but may need to use in some cases.
本节包括模块的一些内部详细信息, 您不是那么需要, 但在一些情况下可能需要使用.
### Domain layer
### 领域层
#### Aggregates
#### 聚合
##### User
##### 用户
A user is generally a person logins to and uses the application.
用户通常是一个登录并使用应用程序的人.
* `IdentityUser` (aggregate root): Represents a user in the system.
* `IdentityUserRole` (collection): Roles to the user.
* `IdentityUserClaim` (collection): Custom claims of the user.
* `IdentityUserLogin` (collection): External logins of the user.
* `IdentityUserToken` (collection): Tokens of the user (used by the Microsoft Identity services).
* `IdentityUser` (聚合根): 表示系统中的一个用户.
* `IdentityUserRole` (集合): 分配给用户的角色.
* `IdentityUserClaim` (集合): 用户的自定义声明.
* `IdentityUserLogin` (集合): 用户的外部登录.
* `IdentityUserToken` (集合): 用户的令牌 (用于 Microsoft Identity 服务).
##### Role
##### 角色
A role is typically a group of permissions to assign to the users.
角色通常是分配给用户的一组权限.
* `IdentityRole` (aggregate root): Represents a role in the system.
* `IdentityRoleClaim` (collection): Custom claims of the role.
* `IdentityRole` (聚合根): 表示系统中的角色.
* `IdentityRoleClaim` (集合): 角色的自定义声明.
##### Claim Type
##### 声明类型
A claim type is a definition of a custom claim that can be assigned to other entities (like roles and users) in the system.
声明类型是可以被分配给系统中其他实体 (如角色和用户) 的自定义声明的定义.
* `IdentityClaimType` (aggregate root): Represents a claim type definition. It contains some properties (e.g. Required, Regex, Description, ValueType) to define the claim type and the validation rules.
A `IdentitySecurityLog` object represents an authentication related operation (like *login*) in the system.
`IdentitySecurityLog` 对象表示系统中与授权相关的操作 (如 *登录*) .
* `IdentitySecurityLog` (aggregate root): Represents a security log in the system.
* `IdentitySecurityLog` (聚合根): 表示系统中的安全日志.
##### OrganizationUnit
##### 组织单元
An Organization unit is a entity in a hierarchical structure.
组织单元是一个有层级结构的实体.
* ```OrganizationUnit``` (aggregate root): Represents an organization unit in the system.
* ```Roles``` (collection): Roles of the organization unit.
* ```OrganizationUnit``` (聚合根): 表示系统中的组织单元.
* ```Roles``` (集合): 组织单元的角色.
#### Repositories
#### 仓储
Following custom repositories are defined for this module:
此模块定义了以下自定义仓储:
* `IIdentityUserRepository`
* `IIdentityRoleRepository`
@ -239,50 +239,50 @@ Following custom repositories are defined for this module:
* ```IIdentitySecurityLogRepository```
* ```IOrganizationUnitRepository```
#### Domain services
#### 领域服务
##### User manager
##### 用户管理
`IdentityUserManager`is used to manage users, their roles, claims, passwords, emails, etc. It is derived from Microsoft Identity's `UserManager<T>` class where `T` is`IdentityUser`.
`IdentityRoleManager`is used to manage roles and their claims. It is derived from Microsoft Identity's `RoleManager<T>` class where `T` is`IdentityRole`.
`IdentityRoleManager`常用于管理角色和他们的声明. 它派生自 Microsoft Identity 的 `RoleManager<T>` 类, 其中 `T` 是`IdentityRole`.
##### Claim type manager
##### 声明类型管理
`IdenityClaimTypeManager`is used to perform some operations for the `IdentityClaimType` aggregate root.
```IdentitySecurityLogManager``` is used to save security logs.
```IdentitySecurityLogManager``` 常用于保存安全日志.
### Application Layer
### 服务层
#### Application Services
#### 应用服务
* `IdentityUserAppService` (implements `IIdentityUserAppService`): Implements the use cases of the user management UI.
* `IdentityRoleAppService` (implement `IIdentityRoleAppService`): Implements the use cases of the role management UI.
* `IdentityClaimTypeAppService` (implements `IIdentityClaimTypeAppService`): Implements the use cases of the claim type management UI.
* `IdentitySettingsAppService` (implements `IIdentitySettingsAppService`): Used to get and update settings for the Identity module.
* `IdentityUserLookupAppService` (implements `IIdentityUserLookupAppService`): Used to get information for a user by `id` or `userName`. It is aimed to be used internally by the ABP framework.
* `ProfileAppService` (implements `IProfileAppService`): Used to change a user's profile and the password.
* ```IdentitySecurityLogAppService``` (implements ```IIdentitySecurityLogAppService```): Implements the use cases of the security logs UI.
* ```OrganizationUnitAppService``` (implements ```OrganizationUnitAppService```): Implements the use cases of the organization unit management UI.
[Volo.Abp.Identity.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Abp.Identity.EntityFrameworkCore) NuGet package implements the EF Core integration.
NuGet 包 [Volo.Abp.Identity.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Abp.Identity.EntityFrameworkCore) 实现了 EF Core 的集成.
##### Database Tables
##### 数据库表
* **AbpRoles**
* AbpRoleClaims
@ -299,9 +299,9 @@ This module provides [Entity Framework Core](../Entity-Framework-Core.md) and [M
#### MongoDB
[Volo.Abp.Identity.MongoDB](https://www.nuget.org/packages/Volo.Abp.Identity.MongoDB) NuGet package implements the MongoDB integration.