XiHan.Framework.Security.Jwt
5.0.0-preview.1
Prefix Reserved
This is a prerelease version of XiHan.Framework.Security.Jwt.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package XiHan.Framework.Security.Jwt --version 5.0.0-preview.1
NuGet\Install-Package XiHan.Framework.Security.Jwt -Version 5.0.0-preview.1
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="XiHan.Framework.Security.Jwt" Version="5.0.0-preview.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.Security.Jwt" Version="5.0.0-preview.1" />
<PackageReference Include="XiHan.Framework.Security.Jwt" />
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 XiHan.Framework.Security.Jwt --version 5.0.0-preview.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiHan.Framework.Security.Jwt, 5.0.0-preview.1"
#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 XiHan.Framework.Security.Jwt@5.0.0-preview.1
#: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=XiHan.Framework.Security.Jwt&version=5.0.0-preview.1&prerelease
#tool nuget:?package=XiHan.Framework.Security.Jwt&version=5.0.0-preview.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XiHan.Framework.Security.Jwt
security.authentication@1 的 JWT Provider(Ring 3,role: provider)。注册后顶替内存实现的认证部分;授权仍由被选中的授权 Provider(默认 Security.InMemory)承担。
builder.AddXiHan(x => x.UseFeature<InMemorySecurityFeature>().UseFeature<JwtSecurityFeature>());
{ "XiHan": { "Security": { "Jwt": { "Secret": "至少 32 字节的对称密钥", "Issuer": "https://issuer", "Audience": "api", "ClockSkewSeconds": 60 } } } }
语义
- 凭据方案
Bearer;HS256 对称密钥(Secret,至少 32 字节)。签发者与受众配置了才校验;必须有过期时间;时钟偏移默认 60 秒。 - 主体 ID 取
NameClaim(默认sub);全部声明按原始类型名保留(不做 .NET 长声明类型映射),角色声明类型由XiHan:Security:RoleClaim决定。 - 校验失败返回
SECURITY_DENIED_003,不区分原因对外暴露;经 ASP.NET Core 宿主是 401 并带WWW-Authenticate: Bearer error="invalid_token"(RFC 6750 §3.1),没有令牌时是 401 并带WWW-Authenticate: Bearer(ADR-0042)。 - 非对称密钥与签发者发现(发现文档与 JWKS)用
Security.OpenIdConnect;两者同一时刻只装配其一。
依赖方向
依赖 Security.Abstractions 与 Microsoft.IdentityModel.JsonWebTokens。
状态
P2:可用。
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Diagnostics.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- Microsoft.IdentityModel.JsonWebTokens (>= 8.23.0)
- System.Threading.RateLimiting (>= 10.0.14)
- XiHan.Framework.Security.Abstractions (>= 5.0.0-preview.1)
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 |
|---|---|---|
| 5.0.0 | 146 | 12/1/2026 |
| 5.0.0-rc.9 | 86 | 11/30/2026 |
| 5.0.0-rc.8 | 151 | 11/28/2026 |
| 5.0.0-rc.7 | 142 | 11/23/2026 |
| 5.0.0-rc.6 | 262 | 11/21/2026 |
| 5.0.0-rc.5 | 92 | 11/20/2026 |
| 5.0.0-rc.4 | 72 | 11/19/2026 |
| 5.0.0-rc.3 | 59 | 11/19/2026 |
| 5.0.0-rc.2 | 59 | 11/15/2026 |
| 5.0.0-rc.1 | 207 | 11/13/2026 |
| 5.0.0-preview.3 | 72 | 11/11/2026 |
| 5.0.0-preview.2 | 110 | 11/6/2026 |
| 5.0.0-preview.1 | 60 | 11/4/2026 |