XiHan.Framework.Security.InMemory
5.0.0-preview.1
Prefix Reserved
This is a prerelease version of XiHan.Framework.Security.InMemory.
There is a newer prerelease 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.InMemory --version 5.0.0-preview.1
NuGet\Install-Package XiHan.Framework.Security.InMemory -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.InMemory" 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.InMemory" Version="5.0.0-preview.1" />
<PackageReference Include="XiHan.Framework.Security.InMemory" />
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.InMemory --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.InMemory, 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.InMemory@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.InMemory&version=5.0.0-preview.1&prerelease
#tool nuget:?package=XiHan.Framework.Security.InMemory&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.InMemory
内存安全。清单 role: default,提供 security.authentication@1(ApiKey 方案)与 security.authorization@1(RBAC 授予存储)。只用于开发、原型与测试。被选为授权能力时,特性在 Configure 里经 FeatureContext.AddStartupCheck 登记启动核对 PolicyCatalog.EnforceOn,核对操作契约按名引用的策略:内核在容器建好之后、任何特性启动之前执行它,不存在(含 permission:<code> 的权限码未登记)即抛出 SECURITY_VALIDATION_004、宿主启动失败,不论失败策略(ADR-0085);之后登记的操作(插件握手之后)在登记时核对(ADR-0080)。
{
"XiHan": {
"Security": {
"InMemory": {
"Principals": {
"alice": { "ApiKey": "dev-alice", "DisplayName": "Alice", "Roles": "admin,editor", "Tenant": "acme", "Claims": { "email": "alice@example.com" } }
},
"Grants": {
"role": { "admin": "*", "editor": "orders.read,orders.write" },
"user": { "alice": "reports.read" }
}
}
}
}
}
语义
ApiKeyAuthenticationHandler:凭据ApiKey <key>对应一个主体;键比较常量时间,不匹配返回SECURITY_DENIED_003。主体记录的租户写成声明,类型取XiHan:MultiTenancy:TenantClaim(缺省tenant),与多租户的声明解析器读同一个键(RFC-0008 认证第 4 条)。InMemoryPermissionGrantStore:配置里的授予是全局的;运行时可用Grant/Revoke增加租户专属授予。上限XiHan:Security:InMemory:MaxPrincipals(1000)与MaxGrants(10000)。被容量拒绝的授予不留下条目,撤销主体在某租户下的最后一条授予时连同这一组移除。- 当另一个显式 Provider(如
Security.Jwt)被选中提供security.authentication时,本包只提供授权部分。 - 健康项
security.inmemory.capacity(InMemorySecurityHealthContributor,同步计算):主体存储或授予存储任一达到上限即 Degraded(SECURITY_UNAVAILABLE_002,先报主体存储),否则 Ready;被顶替的能力对应的存储不参与判定。
依赖方向
依赖 XiHan.Framework.Security.Abstractions。
状态
P2:可用,通过 Security.Conformance 套件。
| 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)
- System.Threading.RateLimiting (>= 10.0.14)
- XiHan.Framework.Security.Abstractions (>= 5.0.0-preview.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on XiHan.Framework.Security.InMemory:
| Package | Downloads |
|---|---|
|
XiHan.Framework.Profiles.Standard
曦寒框架 Standard 组合包 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0-preview.2 | 46 | 11/6/2026 |
| 5.0.0-preview.1 | 49 | 11/4/2026 |