24 changed files with 1818 additions and 0 deletions
@ -0,0 +1,83 @@ |
|||||
|
# LINGYUN.Abp.Identity.Application.Contracts |
||||
|
|
||||
|
Identity authentication application service contracts module, providing interface definitions for identity authentication-related application services. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.AbpIdentityApplicationContractsModule module |
||||
|
* Provides interface definitions for identity authentication-related application services |
||||
|
* Provides DTO object definitions for identity authentication |
||||
|
* Integrates ABP authorization module |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityApplicationContractsModule), |
||||
|
typeof(AbpIdentityDomainSharedModule), |
||||
|
typeof(AbpAuthorizationModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Service Interfaces |
||||
|
|
||||
|
* IIdentityUserAppService - User management service interface |
||||
|
* IIdentityRoleAppService - Role management service interface |
||||
|
* IIdentityClaimTypeAppService - Claim type management service interface |
||||
|
* IIdentitySecurityLogAppService - Security log service interface |
||||
|
* IIdentitySettingsAppService - Identity settings service interface |
||||
|
* IProfileAppService - User profile service interface |
||||
|
|
||||
|
## DTO Objects |
||||
|
|
||||
|
* IdentityUserDto - User DTO |
||||
|
* IdentityRoleDto - Role DTO |
||||
|
* IdentityClaimTypeDto - Claim type DTO |
||||
|
* IdentitySecurityLogDto - Security log DTO |
||||
|
* GetIdentityUsersInput - Get user list input DTO |
||||
|
* GetIdentityRolesInput - Get role list input DTO |
||||
|
* IdentityUserCreateDto - Create user DTO |
||||
|
* IdentityUserUpdateDto - Update user DTO |
||||
|
* IdentityRoleCreateDto - Create role DTO |
||||
|
* IdentityRoleUpdateDto - Update role DTO |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Implement user management service interface |
||||
|
```csharp |
||||
|
public class YourIdentityUserAppService : IIdentityUserAppService |
||||
|
{ |
||||
|
public async Task<IdentityUserDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
// Implement logic to get user |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input) |
||||
|
{ |
||||
|
// Implement logic to get user list |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Implement role management service interface |
||||
|
```csharp |
||||
|
public class YourIdentityRoleAppService : IIdentityRoleAppService |
||||
|
{ |
||||
|
public async Task<IdentityRoleDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
// Implement logic to get role |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) |
||||
|
{ |
||||
|
// Implement logic to get role list |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,83 @@ |
|||||
|
# LINGYUN.Abp.Identity.Application.Contracts |
||||
|
|
||||
|
身份认证应用服务契约模块,提供身份认证相关的应用服务接口定义。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityApplicationContractsModule模块 |
||||
|
* 提供身份认证相关的应用服务接口定义 |
||||
|
* 提供身份认证相关的DTO对象定义 |
||||
|
* 集成ABP授权模块 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityApplicationContractsModule), |
||||
|
typeof(AbpIdentityDomainSharedModule), |
||||
|
typeof(AbpAuthorizationModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 服务接口 |
||||
|
|
||||
|
* IIdentityUserAppService - 用户管理服务接口 |
||||
|
* IIdentityRoleAppService - 角色管理服务接口 |
||||
|
* IIdentityClaimTypeAppService - 声明类型管理服务接口 |
||||
|
* IIdentitySecurityLogAppService - 安全日志服务接口 |
||||
|
* IIdentitySettingsAppService - 身份认证设置服务接口 |
||||
|
* IProfileAppService - 用户配置文件服务接口 |
||||
|
|
||||
|
## DTO对象 |
||||
|
|
||||
|
* IdentityUserDto - 用户DTO |
||||
|
* IdentityRoleDto - 角色DTO |
||||
|
* IdentityClaimTypeDto - 声明类型DTO |
||||
|
* IdentitySecurityLogDto - 安全日志DTO |
||||
|
* GetIdentityUsersInput - 获取用户列表输入DTO |
||||
|
* GetIdentityRolesInput - 获取角色列表输入DTO |
||||
|
* IdentityUserCreateDto - 创建用户DTO |
||||
|
* IdentityUserUpdateDto - 更新用户DTO |
||||
|
* IdentityRoleCreateDto - 创建角色DTO |
||||
|
* IdentityRoleUpdateDto - 更新角色DTO |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 实现用户管理服务接口 |
||||
|
```csharp |
||||
|
public class YourIdentityUserAppService : IIdentityUserAppService |
||||
|
{ |
||||
|
public async Task<IdentityUserDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
// 实现获取用户的逻辑 |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<IdentityUserDto>> GetListAsync(GetIdentityUsersInput input) |
||||
|
{ |
||||
|
// 实现获取用户列表的逻辑 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 实现角色管理服务接口 |
||||
|
```csharp |
||||
|
public class YourIdentityRoleAppService : IIdentityRoleAppService |
||||
|
{ |
||||
|
public async Task<IdentityRoleDto> GetAsync(Guid id) |
||||
|
{ |
||||
|
// 实现获取角色的逻辑 |
||||
|
} |
||||
|
|
||||
|
public async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) |
||||
|
{ |
||||
|
// 实现获取角色列表的逻辑 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,83 @@ |
|||||
|
# LINGYUN.Abp.Identity.Application |
||||
|
|
||||
|
Identity authentication application service module, providing implementation of identity authentication-related application services. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.AbpIdentityApplicationModule module |
||||
|
* Provides implementation of identity authentication-related application services |
||||
|
* Integrates AutoMapper object mapping |
||||
|
* Supports user avatar URL extension property |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityApplicationModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule), |
||||
|
typeof(AbpIdentityDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Application Services |
||||
|
|
||||
|
* IdentityUserAppService - User management service |
||||
|
* IdentityRoleAppService - Role management service |
||||
|
* IdentityClaimTypeAppService - Claim type management service |
||||
|
* IdentitySecurityLogAppService - Security log service |
||||
|
* IdentitySettingsAppService - Identity settings service |
||||
|
* ProfileAppService - User profile service |
||||
|
|
||||
|
## Object Mapping |
||||
|
|
||||
|
The module uses AutoMapper for object mapping, main mappings include: |
||||
|
|
||||
|
* IdentityUser -> IdentityUserDto |
||||
|
* IdentityRole -> IdentityRoleDto |
||||
|
* IdentityClaimType -> IdentityClaimTypeDto |
||||
|
* IdentitySecurityLog -> IdentitySecurityLogDto |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Using user management service |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _userAppService; |
||||
|
|
||||
|
public YourService(IIdentityUserAppService userAppService) |
||||
|
{ |
||||
|
_userAppService = userAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUserDto> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Using role management service |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityRoleAppService _roleAppService; |
||||
|
|
||||
|
public YourService(IIdentityRoleAppService roleAppService) |
||||
|
{ |
||||
|
_roleAppService = roleAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRoleDto> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,83 @@ |
|||||
|
# LINGYUN.Abp.Identity.Application |
||||
|
|
||||
|
身份认证应用服务模块,提供身份认证相关的应用服务实现。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityApplicationModule模块 |
||||
|
* 提供身份认证相关的应用服务实现 |
||||
|
* 集成AutoMapper对象映射 |
||||
|
* 支持用户头像URL扩展属性 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityApplicationModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule), |
||||
|
typeof(AbpIdentityDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 应用服务 |
||||
|
|
||||
|
* IdentityUserAppService - 用户管理服务 |
||||
|
* IdentityRoleAppService - 角色管理服务 |
||||
|
* IdentityClaimTypeAppService - 声明类型管理服务 |
||||
|
* IdentitySecurityLogAppService - 安全日志服务 |
||||
|
* IdentitySettingsAppService - 身份认证设置服务 |
||||
|
* ProfileAppService - 用户配置文件服务 |
||||
|
|
||||
|
## 对象映射 |
||||
|
|
||||
|
模块使用AutoMapper进行对象映射,主要映射包括: |
||||
|
|
||||
|
* IdentityUser -> IdentityUserDto |
||||
|
* IdentityRole -> IdentityRoleDto |
||||
|
* IdentityClaimType -> IdentityClaimTypeDto |
||||
|
* IdentitySecurityLog -> IdentitySecurityLogDto |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 使用用户管理服务 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _userAppService; |
||||
|
|
||||
|
public YourService(IIdentityUserAppService userAppService) |
||||
|
{ |
||||
|
_userAppService = userAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUserDto> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用角色管理服务 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityRoleAppService _roleAppService; |
||||
|
|
||||
|
public YourService(IIdentityRoleAppService roleAppService) |
||||
|
{ |
||||
|
_roleAppService = roleAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRoleDto> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,67 @@ |
|||||
|
# LINGYUN.Abp.Identity.AspNetCore.Session |
||||
|
|
||||
|
User session login extension module, mainly handling login/logout events provided by *AspNetCore.Identity* to manage sessions. |
||||
|
|
||||
|
Due to module responsibility separation principle, please do not confuse with *LINGYUN.Abp.Identity.Session.AspNetCore* module. |
||||
|
|
||||
|
## Configuration Usage |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentityAspNetCoreSessionModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends AbpIdentityAspNetCoreModule module |
||||
|
* Provides session management functionality in AspNetCore environment |
||||
|
* Custom authentication service implementation |
||||
|
* Integrates with AspNetCore.Identity login/logout events |
||||
|
|
||||
|
## Service Implementation |
||||
|
|
||||
|
* AbpIdentitySessionAuthenticationService - Custom authentication service |
||||
|
* Handles user login/logout events |
||||
|
* Manages user session state |
||||
|
* Integrates with Identity session system |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure authentication service |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddTransient<IAuthenticationService, AbpIdentitySessionAuthenticationService>(); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use authentication service |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IAuthenticationService _authenticationService; |
||||
|
|
||||
|
public YourService(IAuthenticationService authenticationService) |
||||
|
{ |
||||
|
_authenticationService = authenticationService; |
||||
|
} |
||||
|
|
||||
|
public async Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties) |
||||
|
{ |
||||
|
await _authenticationService.SignInAsync(context, scheme, principal, properties); |
||||
|
} |
||||
|
|
||||
|
public async Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties) |
||||
|
{ |
||||
|
await _authenticationService.SignOutAsync(context, scheme, properties); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ASP.NET Core Identity Documentation](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity) |
||||
@ -0,0 +1,55 @@ |
|||||
|
# LINGYUN.Abp.Identity.Domain.Shared |
||||
|
|
||||
|
Identity authentication domain shared module, providing basic definitions for identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Provides localization resources for identity authentication |
||||
|
* Provides virtual file system configuration for identity authentication |
||||
|
* Extends Volo.Abp.Identity.AbpIdentityDomainSharedModule module |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
No additional configuration required. |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Reference the module |
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use localization resources |
||||
|
```csharp |
||||
|
public class YourClass |
||||
|
{ |
||||
|
private readonly IStringLocalizer<IdentityResource> _localizer; |
||||
|
|
||||
|
public YourClass(IStringLocalizer<IdentityResource> localizer) |
||||
|
{ |
||||
|
_localizer = localizer; |
||||
|
} |
||||
|
|
||||
|
public string GetLocalizedString(string key) |
||||
|
{ |
||||
|
return _localizer[key]; |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,55 @@ |
|||||
|
# LINGYUN.Abp.Identity.Domain.Shared |
||||
|
|
||||
|
身份认证领域共享模块,提供身份认证相关的基础定义。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 提供身份认证相关的本地化资源 |
||||
|
* 提供身份认证相关的虚拟文件系统配置 |
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityDomainSharedModule模块 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
无需额外配置。 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 引用模块 |
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用本地化资源 |
||||
|
```csharp |
||||
|
public class YourClass |
||||
|
{ |
||||
|
private readonly IStringLocalizer<IdentityResource> _localizer; |
||||
|
|
||||
|
public YourClass(IStringLocalizer<IdentityResource> localizer) |
||||
|
{ |
||||
|
_localizer = localizer; |
||||
|
} |
||||
|
|
||||
|
public string GetLocalizedString(string key) |
||||
|
{ |
||||
|
return _localizer[key]; |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,81 @@ |
|||||
|
# LINGYUN.Abp.Identity.Domain |
||||
|
|
||||
|
Identity authentication domain module, providing core functionality implementation for identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.AbpIdentityDomainModule module |
||||
|
* Provides identity session management functionality |
||||
|
* Provides identity session cleanup functionality |
||||
|
* Supports distributed events |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(Volo.Abp.Identity.AbpIdentityDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
### IdentitySessionCleanupOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"Cleanup": { |
||||
|
"IsEnabled": false, // Enable session cleanup, default: false |
||||
|
"CleanupPeriod": 3600000, // Cleanup interval (milliseconds), default: 1 hour |
||||
|
"InactiveTimeSpan": "30.00:00:00" // Inactive session retention period, default: 30 days |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
### IdentitySessionSignInOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"SignIn": { |
||||
|
"AuthenticationSchemes": ["Identity.Application"], // Authentication schemes for processing |
||||
|
"SignInSessionEnabled": false, // Enable SignInManager login session, default: false |
||||
|
"SignOutSessionEnabled": false // Enable SignInManager logout session, default: false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure identity session management |
||||
|
```csharp |
||||
|
Configure<IdentitySessionSignInOptions>(options => |
||||
|
{ |
||||
|
options.SignInSessionEnabled = true; // Enable login session |
||||
|
options.SignOutSessionEnabled = true; // Enable logout session |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. Configure session cleanup |
||||
|
```csharp |
||||
|
Configure<IdentitySessionCleanupOptions>(options => |
||||
|
{ |
||||
|
options.IsCleanupEnabled = true; // Enable session cleanup |
||||
|
options.CleanupPeriod = 3600000; // Set cleanup interval to 1 hour |
||||
|
options.InactiveTimeSpan = TimeSpan.FromDays(7); // Set inactive session retention period to 7 days |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,81 @@ |
|||||
|
# LINGYUN.Abp.Identity.Domain |
||||
|
|
||||
|
身份认证领域模块,提供身份认证相关的核心功能实现。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityDomainModule模块 |
||||
|
* 提供身份会话管理功能 |
||||
|
* 提供身份会话清理功能 |
||||
|
* 支持分布式事件 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(Volo.Abp.Identity.AbpIdentityDomainModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
### IdentitySessionCleanupOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"Cleanup": { |
||||
|
"IsEnabled": false, // 是否启用会话清理,默认:false |
||||
|
"CleanupPeriod": 3600000, // 会话清理间隔(毫秒),默认:1小时 |
||||
|
"InactiveTimeSpan": "30.00:00:00" // 不活跃会话保持时长,默认:30天 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
### IdentitySessionSignInOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"SignIn": { |
||||
|
"AuthenticationSchemes": ["Identity.Application"], // 用于处理的身份认证方案 |
||||
|
"SignInSessionEnabled": false, // 是否启用SignInManager登录会话,默认:false |
||||
|
"SignOutSessionEnabled": false // 是否启用SignInManager登出会话,默认:false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置身份会话管理 |
||||
|
```csharp |
||||
|
Configure<IdentitySessionSignInOptions>(options => |
||||
|
{ |
||||
|
options.SignInSessionEnabled = true; // 启用登录会话 |
||||
|
options.SignOutSessionEnabled = true; // 启用登出会话 |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. 配置会话清理 |
||||
|
```csharp |
||||
|
Configure<IdentitySessionCleanupOptions>(options => |
||||
|
{ |
||||
|
options.IsCleanupEnabled = true; // 启用会话清理 |
||||
|
options.CleanupPeriod = 3600000; // 设置清理间隔为1小时 |
||||
|
options.InactiveTimeSpan = TimeSpan.FromDays(7); // 设置不活跃会话保持时间为7天 |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
@ -0,0 +1,90 @@ |
|||||
|
# LINGYUN.Abp.Identity.EntityFrameworkCore |
||||
|
|
||||
|
Identity authentication EntityFrameworkCore module, providing data access implementation for identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule module |
||||
|
* Provides EF Core repository implementations for identity authentication |
||||
|
* Supports database mapping for user avatar URL extension property |
||||
|
* Provides EF Core repository implementation for organization units |
||||
|
* Provides EF Core repository implementation for session management |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Repository Implementations |
||||
|
|
||||
|
* EfCoreIdentityUserRepository - User repository implementation |
||||
|
* EfCoreIdentityRoleRepository - Role repository implementation |
||||
|
* EfCoreIdentitySessionRepository - Session repository implementation |
||||
|
* EfCoreOrganizationUnitRepository - Organization unit repository implementation |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure DbContext |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAbpDbContext<IdentityDbContext>(options => |
||||
|
{ |
||||
|
options.AddRepository<IdentityRole, EfCoreIdentityRoleRepository>(); |
||||
|
options.AddRepository<IdentityUser, EfCoreIdentityUserRepository>(); |
||||
|
options.AddRepository<IdentitySession, EfCoreIdentitySessionRepository>(); |
||||
|
options.AddRepository<OrganizationUnit, EfCoreOrganizationUnitRepository>(); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use repositories |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IRepository<IdentityUser, Guid> _userRepository; |
||||
|
private readonly IRepository<IdentityRole, Guid> _roleRepository; |
||||
|
|
||||
|
public YourService( |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
IRepository<IdentityRole, Guid> roleRepository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_roleRepository = roleRepository; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUser> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userRepository.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRole> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleRepository.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Database Migrations |
||||
|
|
||||
|
1. Add migration |
||||
|
```bash |
||||
|
dotnet ef migrations add Added_Identity_Tables |
||||
|
``` |
||||
|
|
||||
|
2. Update database |
||||
|
```bash |
||||
|
dotnet ef database update |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [EF Core Documentation](https://docs.microsoft.com/en-us/ef/core/) |
||||
@ -0,0 +1,90 @@ |
|||||
|
# LINGYUN.Abp.Identity.EntityFrameworkCore |
||||
|
|
||||
|
身份认证EntityFrameworkCore模块,提供身份认证相关的数据访问实现。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule模块 |
||||
|
* 提供身份认证相关的EF Core仓储实现 |
||||
|
* 支持用户头像URL扩展属性的数据库映射 |
||||
|
* 提供组织单元的EF Core仓储实现 |
||||
|
* 提供会话管理的EF Core仓储实现 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(Volo.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 仓储实现 |
||||
|
|
||||
|
* EfCoreIdentityUserRepository - 用户仓储实现 |
||||
|
* EfCoreIdentityRoleRepository - 角色仓储实现 |
||||
|
* EfCoreIdentitySessionRepository - 会话仓储实现 |
||||
|
* EfCoreOrganizationUnitRepository - 组织单元仓储实现 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置DbContext |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAbpDbContext<IdentityDbContext>(options => |
||||
|
{ |
||||
|
options.AddRepository<IdentityRole, EfCoreIdentityRoleRepository>(); |
||||
|
options.AddRepository<IdentityUser, EfCoreIdentityUserRepository>(); |
||||
|
options.AddRepository<IdentitySession, EfCoreIdentitySessionRepository>(); |
||||
|
options.AddRepository<OrganizationUnit, EfCoreOrganizationUnitRepository>(); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用仓储 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IRepository<IdentityUser, Guid> _userRepository; |
||||
|
private readonly IRepository<IdentityRole, Guid> _roleRepository; |
||||
|
|
||||
|
public YourService( |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
IRepository<IdentityRole, Guid> roleRepository) |
||||
|
{ |
||||
|
_userRepository = userRepository; |
||||
|
_roleRepository = roleRepository; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUser> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userRepository.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRole> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleRepository.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 数据库迁移 |
||||
|
|
||||
|
1. 添加迁移 |
||||
|
```bash |
||||
|
dotnet ef migrations add Added_Identity_Tables |
||||
|
``` |
||||
|
|
||||
|
2. 更新数据库 |
||||
|
```bash |
||||
|
dotnet ef database update |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [EF Core文档](https://docs.microsoft.com/en-us/ef/core/) |
||||
@ -0,0 +1,90 @@ |
|||||
|
# LINGYUN.Abp.Identity.HttpApi.Client |
||||
|
|
||||
|
Identity authentication HTTP API client module, providing HTTP API client proxies for identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.AbpIdentityHttpApiClientModule module |
||||
|
* Provides HTTP API client proxies for identity authentication |
||||
|
* Automatically registers HTTP client proxy services |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityHttpApiClientModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"RemoteServices": { |
||||
|
"Identity": { |
||||
|
"BaseUrl": "http://localhost:44388/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Client Proxies |
||||
|
|
||||
|
* IIdentityUserAppService - User management client proxy |
||||
|
* IIdentityRoleAppService - Role management client proxy |
||||
|
* IIdentityClaimTypeAppService - Claim type management client proxy |
||||
|
* IIdentitySecurityLogAppService - Security log client proxy |
||||
|
* IIdentitySettingsAppService - Identity settings client proxy |
||||
|
* IProfileAppService - User profile client proxy |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure remote services |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
Configure<AbpRemoteServiceOptions>(options => |
||||
|
{ |
||||
|
options.RemoteServices.Default = |
||||
|
new RemoteServiceConfiguration(configuration["RemoteServices:Identity:BaseUrl"]); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use client proxies |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _userAppService; |
||||
|
private readonly IIdentityRoleAppService _roleAppService; |
||||
|
|
||||
|
public YourService( |
||||
|
IIdentityUserAppService userAppService, |
||||
|
IIdentityRoleAppService roleAppService) |
||||
|
{ |
||||
|
_userAppService = userAppService; |
||||
|
_roleAppService = roleAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUserDto> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userAppService.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRoleDto> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP HTTP API Client Proxies Documentation](https://docs.abp.io/en/abp/latest/API/HTTP-Client-Proxies) |
||||
@ -0,0 +1,90 @@ |
|||||
|
# LINGYUN.Abp.Identity.HttpApi.Client |
||||
|
|
||||
|
身份认证HTTP API客户端模块,提供身份认证相关的HTTP API客户端代理。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityHttpApiClientModule模块 |
||||
|
* 提供身份认证相关的HTTP API客户端代理 |
||||
|
* 自动注册HTTP客户端代理服务 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityHttpApiClientModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"RemoteServices": { |
||||
|
"Identity": { |
||||
|
"BaseUrl": "http://localhost:44388/" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 客户端代理 |
||||
|
|
||||
|
* IIdentityUserAppService - 用户管理客户端代理 |
||||
|
* IIdentityRoleAppService - 角色管理客户端代理 |
||||
|
* IIdentityClaimTypeAppService - 声明类型管理客户端代理 |
||||
|
* IIdentitySecurityLogAppService - 安全日志客户端代理 |
||||
|
* IIdentitySettingsAppService - 身份认证设置客户端代理 |
||||
|
* IProfileAppService - 用户配置文件客户端代理 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置远程服务 |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
var configuration = context.Services.GetConfiguration(); |
||||
|
|
||||
|
Configure<AbpRemoteServiceOptions>(options => |
||||
|
{ |
||||
|
options.RemoteServices.Default = |
||||
|
new RemoteServiceConfiguration(configuration["RemoteServices:Identity:BaseUrl"]); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用客户端代理 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IIdentityUserAppService _userAppService; |
||||
|
private readonly IIdentityRoleAppService _roleAppService; |
||||
|
|
||||
|
public YourService( |
||||
|
IIdentityUserAppService userAppService, |
||||
|
IIdentityRoleAppService roleAppService) |
||||
|
{ |
||||
|
_userAppService = userAppService; |
||||
|
_roleAppService = roleAppService; |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityUserDto> GetUserAsync(Guid id) |
||||
|
{ |
||||
|
return await _userAppService.GetAsync(id); |
||||
|
} |
||||
|
|
||||
|
public async Task<IdentityRoleDto> GetRoleAsync(Guid id) |
||||
|
{ |
||||
|
return await _roleAppService.GetAsync(id); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP HTTP API客户端代理文档](https://docs.abp.io/en/abp/latest/API/HTTP-Client-Proxies) |
||||
@ -0,0 +1,85 @@ |
|||||
|
# LINGYUN.Abp.Identity.HttpApi |
||||
|
|
||||
|
Identity authentication HTTP API module, providing HTTP API interfaces for identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends Volo.Abp.Identity.AbpIdentityHttpApiModule module |
||||
|
* Provides HTTP API interfaces for identity authentication |
||||
|
* Supports MVC data annotations with localization resources |
||||
|
* Automatically registers MVC application parts |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityHttpApiModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## API Controllers |
||||
|
|
||||
|
* IdentityUserController - User management API |
||||
|
* IdentityRoleController - Role management API |
||||
|
* IdentityClaimTypeController - Claim type management API |
||||
|
* IdentitySecurityLogController - Security log API |
||||
|
* IdentitySettingsController - Identity settings API |
||||
|
* ProfileController - User profile API |
||||
|
|
||||
|
## API Routes |
||||
|
|
||||
|
* `/api/identity/users` - User management API routes |
||||
|
* `/api/identity/roles` - Role management API routes |
||||
|
* `/api/identity/claim-types` - Claim type management API routes |
||||
|
* `/api/identity/security-logs` - Security log API routes |
||||
|
* `/api/identity/settings` - Identity settings API routes |
||||
|
* `/api/identity/my-profile` - User profile API routes |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure localization |
||||
|
```csharp |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.AddAssemblyResource(typeof(IdentityResource), typeof(AbpIdentityApplicationContractsModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Use APIs |
||||
|
```csharp |
||||
|
// Get user list |
||||
|
GET /api/identity/users |
||||
|
|
||||
|
// Get specific user |
||||
|
GET /api/identity/users/{id} |
||||
|
|
||||
|
// Create user |
||||
|
POST /api/identity/users |
||||
|
{ |
||||
|
"userName": "admin", |
||||
|
"email": "admin@abp.io", |
||||
|
"password": "1q2w3E*" |
||||
|
} |
||||
|
|
||||
|
// Update user |
||||
|
PUT /api/identity/users/{id} |
||||
|
{ |
||||
|
"userName": "admin", |
||||
|
"email": "admin@abp.io" |
||||
|
} |
||||
|
|
||||
|
// Delete user |
||||
|
DELETE /api/identity/users/{id} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP HTTP API Documentation](https://docs.abp.io/en/abp/latest/API/HTTP-API) |
||||
@ -0,0 +1,85 @@ |
|||||
|
# LINGYUN.Abp.Identity.HttpApi |
||||
|
|
||||
|
身份认证HTTP API模块,提供身份认证相关的HTTP API接口。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展Volo.Abp.Identity.AbpIdentityHttpApiModule模块 |
||||
|
* 提供身份认证相关的HTTP API接口 |
||||
|
* 支持本地化资源的MVC数据注解 |
||||
|
* 自动注册MVC应用程序部件 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityHttpApiModule), |
||||
|
typeof(AbpIdentityApplicationContractsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## API控制器 |
||||
|
|
||||
|
* IdentityUserController - 用户管理API |
||||
|
* IdentityRoleController - 角色管理API |
||||
|
* IdentityClaimTypeController - 声明类型管理API |
||||
|
* IdentitySecurityLogController - 安全日志API |
||||
|
* IdentitySettingsController - 身份认证设置API |
||||
|
* ProfileController - 用户配置文件API |
||||
|
|
||||
|
## API路由 |
||||
|
|
||||
|
* `/api/identity/users` - 用户管理API路由 |
||||
|
* `/api/identity/roles` - 角色管理API路由 |
||||
|
* `/api/identity/claim-types` - 声明类型管理API路由 |
||||
|
* `/api/identity/security-logs` - 安全日志API路由 |
||||
|
* `/api/identity/settings` - 身份认证设置API路由 |
||||
|
* `/api/identity/my-profile` - 用户配置文件API路由 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置本地化 |
||||
|
```csharp |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
||||
|
{ |
||||
|
options.AddAssemblyResource(typeof(IdentityResource), typeof(AbpIdentityApplicationContractsModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 使用API |
||||
|
```csharp |
||||
|
// 获取用户列表 |
||||
|
GET /api/identity/users |
||||
|
|
||||
|
// 获取指定用户 |
||||
|
GET /api/identity/users/{id} |
||||
|
|
||||
|
// 创建用户 |
||||
|
POST /api/identity/users |
||||
|
{ |
||||
|
"userName": "admin", |
||||
|
"email": "admin@abp.io", |
||||
|
"password": "1q2w3E*" |
||||
|
} |
||||
|
|
||||
|
// 更新用户 |
||||
|
PUT /api/identity/users/{id} |
||||
|
{ |
||||
|
"userName": "admin", |
||||
|
"email": "admin@abp.io" |
||||
|
} |
||||
|
|
||||
|
// 删除用户 |
||||
|
DELETE /api/identity/users/{id} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP HTTP API文档](https://docs.abp.io/en/abp/latest/API/HTTP-API) |
||||
@ -0,0 +1,78 @@ |
|||||
|
# LINGYUN.Abp.Identity.Notifications |
||||
|
|
||||
|
Identity authentication notification module, providing notification functionality related to identity authentication. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends AbpNotificationsModule module |
||||
|
* Provides notification definitions related to identity authentication |
||||
|
* Supports session expiration notifications |
||||
|
* Provides identity session revocation event handling |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpNotificationsModule), |
||||
|
typeof(AbpDddDomainSharedModule), |
||||
|
typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Notification Definitions |
||||
|
|
||||
|
### Session Notifications |
||||
|
|
||||
|
* `AbpIdentity.Session.Expiration` - Session expiration notification |
||||
|
* Sent when a user's session expires |
||||
|
* Notifies the user that their session has expired and they need to log in again |
||||
|
|
||||
|
## Event Handling |
||||
|
|
||||
|
### IdentitySessionRevokeEventHandler |
||||
|
|
||||
|
Handles identity session revocation events. When a session is revoked: |
||||
|
* Sends session expiration notification to relevant users |
||||
|
* Notifies users they need to log in again |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Subscribe to session expiration notifications |
||||
|
```csharp |
||||
|
public class YourNotificationHandler : INotificationHandler<SessionExpirationNotification> |
||||
|
{ |
||||
|
public async Task HandleNotificationAsync(SessionExpirationNotification notification) |
||||
|
{ |
||||
|
// Handle session expiration notification |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Send session expiration notification |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly INotificationSender _notificationSender; |
||||
|
|
||||
|
public YourService(INotificationSender notificationSender) |
||||
|
{ |
||||
|
_notificationSender = notificationSender; |
||||
|
} |
||||
|
|
||||
|
public async Task SendSessionExpirationNotificationAsync(Guid userId) |
||||
|
{ |
||||
|
await _notificationSender.SendAsync( |
||||
|
IdentityNotificationNames.Session.ExpirationSession, |
||||
|
new NotificationData(), |
||||
|
userIds: new[] { userId }); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP Notification System Documentation](https://docs.abp.io/en/abp/latest/Notification-System) |
||||
@ -0,0 +1,78 @@ |
|||||
|
# LINGYUN.Abp.Identity.Notifications |
||||
|
|
||||
|
身份认证通知模块,提供身份认证相关的通知功能。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展AbpNotificationsModule模块 |
||||
|
* 提供身份认证相关的通知定义 |
||||
|
* 支持会话过期通知 |
||||
|
* 提供身份会话撤销事件处理 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpNotificationsModule), |
||||
|
typeof(AbpDddDomainSharedModule), |
||||
|
typeof(AbpIdentityDomainSharedModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 通知定义 |
||||
|
|
||||
|
### 会话通知 |
||||
|
|
||||
|
* `AbpIdentity.Session.Expiration` - 会话过期通知 |
||||
|
* 当用户会话过期时发送此通知 |
||||
|
* 通知用户其会话已经过期,需要重新登录 |
||||
|
|
||||
|
## 事件处理 |
||||
|
|
||||
|
### IdentitySessionRevokeEventHandler |
||||
|
|
||||
|
处理身份会话撤销事件,当会话被撤销时: |
||||
|
* 发送会话过期通知给相关用户 |
||||
|
* 通知用户需要重新登录 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 订阅会话过期通知 |
||||
|
```csharp |
||||
|
public class YourNotificationHandler : INotificationHandler<SessionExpirationNotification> |
||||
|
{ |
||||
|
public async Task HandleNotificationAsync(SessionExpirationNotification notification) |
||||
|
{ |
||||
|
// 处理会话过期通知 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 发送会话过期通知 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly INotificationSender _notificationSender; |
||||
|
|
||||
|
public YourService(INotificationSender notificationSender) |
||||
|
{ |
||||
|
_notificationSender = notificationSender; |
||||
|
} |
||||
|
|
||||
|
public async Task SendSessionExpirationNotificationAsync(Guid userId) |
||||
|
{ |
||||
|
await _notificationSender.SendAsync( |
||||
|
IdentityNotificationNames.Session.ExpirationSession, |
||||
|
new NotificationData(), |
||||
|
userIds: new[] { userId }); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP通知系统文档](https://docs.abp.io/en/abp/latest/Notification-System) |
||||
@ -0,0 +1,84 @@ |
|||||
|
# LINGYUN.Abp.Identity.OrganizaztionUnits |
||||
|
|
||||
|
Identity authentication organization units module, providing integration functionality between the identity authentication system and organization units. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Extends AbpIdentityDomainModule module |
||||
|
* Integrates AbpAuthorizationOrganizationUnitsModule module |
||||
|
* Supports dynamic addition of organization unit claims |
||||
|
* Provides organization unit-related identity authentication functionality |
||||
|
|
||||
|
## Module Dependencies |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(AbpAuthorizationOrganizationUnitsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration |
||||
|
|
||||
|
### AbpClaimsPrincipalFactoryOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Abp": { |
||||
|
"Security": { |
||||
|
"Claims": { |
||||
|
"DynamicClaims": { |
||||
|
"OrganizationUnit": true // Enable organization unit dynamic claims |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Claim Types |
||||
|
|
||||
|
* `AbpOrganizationUnitClaimTypes.OrganizationUnit` - Organization unit claim type |
||||
|
* Used to identify the organization unit a user belongs to |
||||
|
* Automatically added to claims during user authentication |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure organization unit claims |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpClaimsPrincipalFactoryOptions>(options => |
||||
|
{ |
||||
|
options.DynamicClaims.Add(AbpOrganizationUnitClaimTypes.OrganizationUnit); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. Get user's organization unit claims |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ICurrentUser _currentUser; |
||||
|
|
||||
|
public YourService(ICurrentUser currentUser) |
||||
|
{ |
||||
|
_currentUser = currentUser; |
||||
|
} |
||||
|
|
||||
|
public string[] GetUserOrganizationUnits() |
||||
|
{ |
||||
|
return _currentUser.FindClaims(AbpOrganizationUnitClaimTypes.OrganizationUnit) |
||||
|
.Select(c => c.Value) |
||||
|
.ToArray(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP Organization Units Documentation](https://docs.abp.io/en/abp/latest/Organization-Units) |
||||
@ -0,0 +1,84 @@ |
|||||
|
# LINGYUN.Abp.Identity.OrganizaztionUnits |
||||
|
|
||||
|
身份认证组织单元模块,提供身份认证系统与组织单元的集成功能。 |
||||
|
|
||||
|
## 功能特性 |
||||
|
|
||||
|
* 扩展AbpIdentityDomainModule模块 |
||||
|
* 集成AbpAuthorizationOrganizationUnitsModule模块 |
||||
|
* 支持组织单元声明动态添加 |
||||
|
* 提供组织单元相关的身份认证功能 |
||||
|
|
||||
|
## 模块引用 |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn( |
||||
|
typeof(AbpIdentityDomainModule), |
||||
|
typeof(AbpAuthorizationOrganizationUnitsModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 配置项 |
||||
|
|
||||
|
### AbpClaimsPrincipalFactoryOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Abp": { |
||||
|
"Security": { |
||||
|
"Claims": { |
||||
|
"DynamicClaims": { |
||||
|
"OrganizationUnit": true // 启用组织单元动态声明 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 声明类型 |
||||
|
|
||||
|
* `AbpOrganizationUnitClaimTypes.OrganizationUnit` - 组织单元声明类型 |
||||
|
* 用于标识用户所属的组织单元 |
||||
|
* 在用户身份验证时自动添加到声明中 |
||||
|
|
||||
|
## 基本用法 |
||||
|
|
||||
|
1. 配置组织单元声明 |
||||
|
```csharp |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpClaimsPrincipalFactoryOptions>(options => |
||||
|
{ |
||||
|
options.DynamicClaims.Add(AbpOrganizationUnitClaimTypes.OrganizationUnit); |
||||
|
}); |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
2. 获取用户的组织单元声明 |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly ICurrentUser _currentUser; |
||||
|
|
||||
|
public YourService(ICurrentUser currentUser) |
||||
|
{ |
||||
|
_currentUser = currentUser; |
||||
|
} |
||||
|
|
||||
|
public string[] GetUserOrganizationUnits() |
||||
|
{ |
||||
|
return _currentUser.FindClaims(AbpOrganizationUnitClaimTypes.OrganizationUnit) |
||||
|
.Select(c => c.Value) |
||||
|
.ToArray(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## 更多信息 |
||||
|
|
||||
|
* [ABP身份认证文档](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP组织单元文档](https://docs.abp.io/en/abp/latest/Organization-Units) |
||||
@ -0,0 +1,97 @@ |
|||||
|
# LINGYUN.Abp.Identity.Session.AspNetCore |
||||
|
|
||||
|
Identity service user session extension module. |
||||
|
|
||||
|
## Interface Description |
||||
|
|
||||
|
### AbpSessionMiddleware extracts *sessionId* from user token in the request pipeline as a global session identifier, which can be used to log out sessions |
||||
|
> Note: When anonymous users access, the request *CorrelationId* is used as the identifier; |
||||
|
When *CorrelationId* does not exist, use random *Guid.NewGuid()*. |
||||
|
|
||||
|
### HttpContextDeviceInfoProvider extracts device identification from request parameters |
||||
|
|
||||
|
> Due to module responsibility separation principle, please do not confuse with *LINGYUN.Abp.Identity.AspNetCore.Session* module |
||||
|
|
||||
|
### HttpContextDeviceInfoProvider is used to handle session IP address location parsing |
||||
|
|
||||
|
> IsParseIpLocation will parse the geographical location of session IP when enabled |
||||
|
> IgnoreProvinces are provinces that need to be ignored when parsing geographical locations, usually China's municipalities |
||||
|
> LocationParser customizes the geographical location data that needs to be processed |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Provides session management functionality in AspNetCore environment |
||||
|
* Supports extracting device identification information from requests |
||||
|
* Supports IP geolocation parsing |
||||
|
* Depends on AbpAspNetCoreModule, AbpIP2RegionModule, and AbpIdentitySessionModule |
||||
|
|
||||
|
## Configuration Options |
||||
|
|
||||
|
### AbpIdentitySessionAspNetCoreOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"AspNetCore": { |
||||
|
"IsParseIpLocation": false, // Whether to parse IP geographic information, default: false |
||||
|
"IgnoreProvinces": [ // Provinces to ignore, default includes China's municipalities |
||||
|
"Beijing", |
||||
|
"Shanghai", |
||||
|
"Tianjin", |
||||
|
"Chongqing" |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Basic Usage |
||||
|
|
||||
|
1. Configure IP geolocation parsing |
||||
|
```csharp |
||||
|
Configure<AbpIdentitySessionAspNetCoreOptions>(options => |
||||
|
{ |
||||
|
options.IsParseIpLocation = true; // Enable IP geolocation parsing |
||||
|
options.IgnoreProvinces.Add("Hong Kong"); // Add provinces to ignore |
||||
|
options.LocationParser = (locationInfo) => |
||||
|
{ |
||||
|
// Custom geolocation parsing logic |
||||
|
return $"{locationInfo.Country}{locationInfo.Province}{locationInfo.City}"; |
||||
|
}; |
||||
|
}); |
||||
|
``` |
||||
|
|
||||
|
2. Use device information provider |
||||
|
```csharp |
||||
|
public class YourService |
||||
|
{ |
||||
|
private readonly IDeviceInfoProvider _deviceInfoProvider; |
||||
|
|
||||
|
public YourService(IDeviceInfoProvider deviceInfoProvider) |
||||
|
{ |
||||
|
_deviceInfoProvider = deviceInfoProvider; |
||||
|
} |
||||
|
|
||||
|
public async Task<DeviceInfo> GetDeviceInfoAsync() |
||||
|
{ |
||||
|
return await _deviceInfoProvider.GetDeviceInfoAsync(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration Usage |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentitySessionAspNetCoreModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
// other |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
|
* [ABP AspNetCore Documentation](https://docs.abp.io/en/abp/latest/AspNetCore) |
||||
@ -0,0 +1,48 @@ |
|||||
|
# LINGYUN.Abp.Identity.Session |
||||
|
|
||||
|
User session foundation module, providing related common interfaces. |
||||
|
|
||||
|
## Features |
||||
|
|
||||
|
* Provides basic interfaces for user session management |
||||
|
* Provides session cache and persistence synchronization mechanism |
||||
|
* Supports session access time tracking |
||||
|
* Depends on AbpCachingModule |
||||
|
|
||||
|
## Configuration Usage |
||||
|
|
||||
|
```csharp |
||||
|
[DependsOn(typeof(AbpIdentitySessionModule))] |
||||
|
public class YouProjectModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<IdentitySessionCheckOptions>(options => |
||||
|
{ |
||||
|
// Set session cache and persistence refresh interval to 10 minutes |
||||
|
options.KeepAccessTimeSpan = TimeSpan.FromMinutes(10); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## Configuration Options |
||||
|
|
||||
|
### IdentitySessionCheckOptions |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"Identity": { |
||||
|
"Session": { |
||||
|
"Check": { |
||||
|
"KeepAccessTimeSpan": "00:01:00", // Access retention duration (cache session refresh interval), default: 1 minute |
||||
|
"SessionSyncTimeSpan": "00:10:00" // Session sync interval (sync from cache to persistence), default: 10 minutes |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
## More Information |
||||
|
|
||||
|
* [ABP Identity Documentation](https://docs.abp.io/en/abp/latest/Identity) |
||||
Loading…
Reference in new issue