KernLab.Claim.Client 1.0.0-alpha.3

This is a prerelease version of KernLab.Claim.Client.
dotnet add package KernLab.Claim.Client --version 1.0.0-alpha.3
                    
NuGet\Install-Package KernLab.Claim.Client -Version 1.0.0-alpha.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KernLab.Claim.Client" Version="1.0.0-alpha.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KernLab.Claim.Client" Version="1.0.0-alpha.3" />
                    
Directory.Packages.props
<PackageReference Include="KernLab.Claim.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KernLab.Claim.Client --version 1.0.0-alpha.3
                    
#r "nuget: KernLab.Claim.Client, 1.0.0-alpha.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package KernLab.Claim.Client@1.0.0-alpha.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=KernLab.Claim.Client&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=KernLab.Claim.Client&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Tool

KernLab.Claim.Client

消费方 SDK——业务服务 / 网关 / 控制台接入 KernLab.Claim 的共享实现面: TokenClient(client_credentials / authorization_code+PKCE / refresh 轮换 / token-exchange)、 JWKS 拉取与缓存、JwtVerifier 本地验签。只依赖 KernLab.Claim.Protocol——不背签发引擎。

安装

dotnet add package KernLab.Claim.Client

最小用法

取 token(client_credentials)

var tokens = new TokenClient();
var issued = await tokens.ClientCredentialsAsync(
    "https://claim.example/connect/token", "svc", secret, scope: "kernlab.cohort.config.read");

授权码流(PKCE S256 强制)

var verifier = TokenClient.NewCodeVerifier();
var url = TokenClient.BuildAuthorizeUrl(
    authorizeEndpoint, clientId, redirectUri, "openid offline_access", state, verifier);
// 302 浏览器 → 登录 → 回跳 code → 换取:
var issued = await tokens.AuthorizationCodeAsync(
    tokenEndpoint, clientId, clientSecret, code, redirectUri, verifier);

本地验签(JWKS 拉取缓存 + ES256)

var verifier = new JwtVerifier(new JwksFetcher(httpClient, jwksUri));
var verified = await verifier.VerifyAsync(issued.AccessToken,
    expectedIssuer: "https://claim.example",
    expectedAudience: clientId);   // ★ 验签必带 aud——契约 §4 强制校验纪律(G11)

验签纪律(契约 §4)

  • 必带 expectedAudience——aud 强制校验;缺省不校验的调用形态视为契约违规;
  • kid 未命中自动刷新 JWKS 重验一次(签发方轮换无感);
  • 时间窗/签发者/算法白名单(none 恒禁)内建。

License

MIT © KernLab.Claim Contributors

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0-alpha.3 103 10/5/2026
1.0.0-alpha.2 71 9/29/2026
1.0.0-alpha.1 74 9/26/2026