IdentityLinker.Bff.Yarp
2.0.0
See the version list below for details.
dotnet add package IdentityLinker.Bff.Yarp --version 2.0.0
NuGet\Install-Package IdentityLinker.Bff.Yarp -Version 2.0.0
<PackageReference Include="IdentityLinker.Bff.Yarp" Version="2.0.0" />
<PackageVersion Include="IdentityLinker.Bff.Yarp" Version="2.0.0" />
<PackageReference Include="IdentityLinker.Bff.Yarp" />
paket add IdentityLinker.Bff.Yarp --version 2.0.0
#r "nuget: IdentityLinker.Bff.Yarp, 2.0.0"
#:package IdentityLinker.Bff.Yarp@2.0.0
#addin nuget:?package=IdentityLinker.Bff.Yarp&version=2.0.0
#tool nuget:?package=IdentityLinker.Bff.Yarp&version=2.0.0
IdentityLinker 2
IdentityLinker 2 是面向 .NET 10 的身份框架。它以 IdentityServer4 的公开使用体验为兼容基线,OAuth/OIDC 与 SAML 协议引擎依据公开标准独立实现,并使用 ASP.NET Core、Microsoft.IdentityModel、.NET 密码学/XML 基础设施与 YARP 承载平台能力。
当前实现状态和逐项验收矩阵见仓库根目录的 IMPLEMENTATION_PLAN.md。
结构化产品契约从 IdentityLinker 产品域文档 进入;仓库级索引由 docs/product-domains/catalog.md 生成。
设计目标
- OAuth 2.x、OpenID Connect、SAML 2.0、DCR、DPoP、CIBA、FAPI 配置评估与 BFF。
- IdentityServer4 风格的简洁 fluent API。
- 存储、验证、声明、密钥、会话、事件和协议交互均可替换。
- 生产环境安全失败;开发凭据不会自动进入 Production。
- 发布包及其依赖图只包含本仓库实现与已列明的第三方基础库。
CIBA 交付边界
默认配置安全支持 CIBA poll,并在配置可恢复通知 outbox 后支持 ping。push token response 默认未启用;只有显式注册履行一次性签发、持久化/对账和 outbox 契约的 ICibaPushTokenResponseWorker 后才会开放。未注册完整 worker 时,即使客户端 metadata 配置了 push,请求也会明确返回 invalid_request,发现文档不会宣称支持 push。这项 fail-closed 行为用于避免向客户端发送空响应、重复令牌或无法对账的令牌。
通过 AddCibaPushTokenResponseWorker<TWorker>() 注册实现;实现只有在 token response 已写入可靠 outbox 后才可返回 CibaPushTokenResponseResult.Queued()。
最小入口
默认场景可安装聚合包:
dotnet add package IdentityLinker
builder.Services.AddIdentityLinker(options =>
{
options.Issuer = new Uri("https://identity.example.com");
});
var app = builder.Build();
app.UseIdentityLinker();
app.MapIdentityLinkerEndpoints();
动态客户端注册
安装 IdentityLinker.Configuration 后,在同一 fluent builder 上启用 RFC 7591/7592:
builder.Services.AddIdentityLinker(options =>
{
options.Issuer = new Uri("https://identity.example.com");
})
.AddIdentityLinkerConfiguration(options =>
{
options.RegistrationEndpointPath = "/connect/register";
});
app.MapIdentityLinkerEndpoints();
默认拒绝没有 initial access token 的注册请求;生产环境必须通过 AddInitialAccessTokenValidator<TValidator>() 注册自有 IInitialAccessTokenValidator,并提供持久化的客户端注册 store 和 registration access token service。
BFF 安全入口
BFF 必须显式配置受信任公开源;callback、logout 和代理转发信息不会从请求的 Host、scheme 或 PathBase 推导。部署在反向代理子路径时使用 PublicPathBase:
builder.Services.AddBff(options =>
{
options.PublicOrigin = new Uri("https://app.example.com");
options.PublicPathBase = "/portal";
options.Oidc.Authority = new Uri("https://identity.example.com");
options.Oidc.ClientId = "portal-bff";
options.Oidc.ClientSecret = builder.Configuration["Bff:ClientSecret"];
});
EF Core store 对高熵 session handle 使用域分离 SHA-256;对可枚举的 sid、sub 和 logout jti 必须使用持久、可轮换的具名 HMAC 密钥。当前密钥用于写入,历史密钥仅用于查询和撤销旧记录:
builder.Services.AddBff(options =>
{
options.PublicOrigin = new Uri("https://app.example.com");
options.Oidc.Authority = new Uri("https://identity.example.com");
options.Oidc.ClientId = "portal-bff";
options.Oidc.ClientSecret = builder.Configuration["Bff:ClientSecret"];
})
.AddEntityFrameworkCore<AppDbContext>(store =>
{
store.ActiveIndexKey = new BffEntityIndexKey(
"2026-07",
Convert.FromBase64String(
builder.Configuration["Bff:IndexKey"] ??
throw new InvalidOperationException("缺少 BFF 索引密钥。")));
});
索引密钥必须来自 secret manager 或 HSM 注入,至少 32 个随机字节;不得写入源码、日志或普通配置文件。轮换时先把旧密钥加入 PreviousIndexKeys,待所有旧记录自然过期或迁移完成后再移除。
各模块的独立包消费示例位于 tests/IdentityLinker.*.PackageConsumer*,可用于验证只通过 NuGet 包引用时的构建、provider 互操作与运行时行为。Entity Framework Core、BFF Entity Framework Core 和 Configuration Entity Framework Core 包不承诺 Native AOT 或 trimming。
示例与验证
仓库已提供 Core、SAML、EntityFrameworkCore、JwtBearer、BFF 和 Blazor Client 的包消费与专项回归项目;EntityFrameworkCore 相关验证以真实 EF Core provider 和并发事务测试为准。示例代码以当前正式 src/ 实现为准,发布前的剩余门禁和最新证据统一记录在 IMPLEMENTATION_PLAN.md。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- IdentityLinker.Bff (>= 2.0.0)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.19.2)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.19.2)
- Microsoft.IdentityModel.Tokens (>= 8.19.2)
- Yarp.ReverseProxy (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview.2 | 68 | 8/4/2026 |
| 3.0.0-preview.1 | 66 | 7/29/2026 |
| 2.0.0 | 107 | 7/18/2026 |
| 1.0.0 | 118 | 6/6/2026 |