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.
2.3 KiB
2.3 KiB
LINGYUN.Abp.OpenIddict.LinkUser
简介
LINGYUN.Abp.OpenIddict.LinkUser 是 OpenIddict 的用户链接扩展模块,提供了用户之间的链接认证功能。
功能特性
-
用户链接认证
- 支持用户之间的链接认证
- 支持跨租户用户链接
- 支持访问令牌交换
-
扩展授权类型
- 添加 link_user 授权类型
- 支持自定义授权流程
- 安全日志记录
-
多语言支持
- 集成 ABP 本地化框架
- 支持自定义错误消息
安装
dotnet add package LINGYUN.Abp.OpenIddict.LinkUser
使用
-
添加
[DependsOn(typeof(AbpOpenIddictLinkUserModule))]到你的模块类。 -
配置 OpenIddict 服务器:
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<OpenIddictServerBuilder>(builder =>
{
// 允许 link_user 授权类型
builder.AllowLinkUserFlow();
});
}
- 使用示例:
POST /connect/token
Content-Type: application/x-www-form-urlencoded
grant_type=link_user&
access_token=current-user-access-token&
LinkUserId=target-user-id&
LinkTenantId=target-tenant-id&
scope=openid profile
参数说明
-
access_token (必填)
- 当前用户的访问令牌
- 用于验证当前用户身份
-
LinkUserId (必填)
- 目标链接用户的ID
- 必须是有效的GUID格式
-
LinkTenantId (可选)
- 目标链接用户所属的租户ID
- 如果指定,必须是有效的GUID格式
-
scope (可选)
- 请求的权限范围
- 默认包含 openid profile
注意事项
- 必须提供有效的访问令牌
- 目标用户必须与当前用户存在链接关系
- 跨租户链接时需要指定正确的租户ID
- 所有操作都会记录安全日志
- 建议在生产环境中使用 HTTPS