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.
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" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.Security.InMemory" />
                    
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 XiHan.Framework.Security.InMemory --version 5.0.0-preview.1
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.Security.InMemory&version=5.0.0-preview.1&prerelease
                    
Install as a Cake Tool

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 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.

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