You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
1 year ago | |
|---|---|---|
| .. | ||
| LINGYUN/Abp/Identity/OrganizaztionUnits | 2 years ago | |
| FodyWeavers.xml | 2 years ago | |
| FodyWeavers.xsd | 2 years ago | |
| LINGYUN.Abp.Identity.OrganizaztionUnits.csproj | 2 years ago | |
| README.EN.md | 1 year ago | |
| README.md | 1 year ago | |
README.md
LINGYUN.Abp.Identity.OrganizaztionUnits
身份认证组织单元模块,提供身份认证系统与组织单元的集成功能。
功能特性
- 扩展AbpIdentityDomainModule模块
- 集成AbpAuthorizationOrganizationUnitsModule模块
- 支持组织单元声明动态添加
- 提供组织单元相关的身份认证功能
模块引用
[DependsOn(
typeof(AbpIdentityDomainModule),
typeof(AbpAuthorizationOrganizationUnitsModule))]
public class YouProjectModule : AbpModule
{
// other
}
配置项
AbpClaimsPrincipalFactoryOptions
{
"Abp": {
"Security": {
"Claims": {
"DynamicClaims": {
"OrganizationUnit": true // 启用组织单元动态声明
}
}
}
}
}
声明类型
AbpOrganizationUnitClaimTypes.OrganizationUnit- 组织单元声明类型- 用于标识用户所属的组织单元
- 在用户身份验证时自动添加到声明中
基本用法
- 配置组织单元声明
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpClaimsPrincipalFactoryOptions>(options =>
{
options.DynamicClaims.Add(AbpOrganizationUnitClaimTypes.OrganizationUnit);
});
}
- 获取用户的组织单元声明
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();
}
}