Cohesive.Identity 0.1.0-alpha.5

This is a prerelease version of Cohesive.Identity.
dotnet add package Cohesive.Identity --version 0.1.0-alpha.5
                    
NuGet\Install-Package Cohesive.Identity -Version 0.1.0-alpha.5
                    
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="Cohesive.Identity" Version="0.1.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cohesive.Identity" Version="0.1.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="Cohesive.Identity" />
                    
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 Cohesive.Identity --version 0.1.0-alpha.5
                    
#r "nuget: Cohesive.Identity, 0.1.0-alpha.5"
                    
#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 Cohesive.Identity@0.1.0-alpha.5
                    
#: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=Cohesive.Identity&version=0.1.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Cohesive.Identity&version=0.1.0-alpha.5&prerelease
                    
Install as a Cake Tool

Cohesive.Identity

Identity context, scope resolution, and canonical entity-query directory helpers for Cohesive applications.

Install

dotnet add package Cohesive.Identity

Use When

  • You need to resolve operation context, principal identity, and scope references in a Cohesive application.
  • You want a canonical, backend-independent identity directory over registered entity sources.
  • You want a small in-memory identity directory for local development, tests, or bootstrap flows.
  • You need identity-aware API or storage adapters to share the same operation context model.

Example

using Cohesive.Identity;

var directory = InMemoryIdentityDomainRepositoryFactory
    .Create(new InMemoryIdentityDirectoryBuilder()
        .AddScope(new("tenant-a", "tenant", "Tenant A"))
        .AddPrincipal(new("user:alice", PrincipalKind.User, Email: "alice@example.com"))
        .AddScopeGrant("user:alice", "tenant-a", "tenant", ["orders.read"], isDefaultScope: true)
        .Build())
    .CreateDirectory();

var principal = await directory.FindPrincipalAsync(new(Email: "alice@example.com"));

CreateDirectory() registers the three graph-qualified Identity entity shapes with EntityRelationQuerySourceCatalog, creates a canonical evaluator, and passes that evaluator to EntityRepositoryIdentityDirectory. The same directory can run over another placement by constructing it with any appropriately configured IRelationQueryEvaluator:

IIdentityDirectory directory = new EntityRepositoryIdentityDirectory(evaluator);

Canonical Directory Queries

IdentityDirectoryQueries exposes the stable persisted query documents used for principal, membership, default scope, and active-scope lookups. The definitions are authored once against IdentityDomainModel.ShapeGraphDocument; invocation values are supplied separately as required typed parameters. This keeps query identity and fingerprints stable while allowing each evaluator to compile, place, and execute the same semantics against its registered sources.

The directory preserves the security-relevant lookup contract:

  • Principal keys are considered in order: local principal id, normalized email, subject, then client id.
  • Active status checks are canonical query predicates, rather than host-side filtering.
  • Single-result lookups request at most two rows so ambiguous principal, scope, or visible default-membership data is detected instead of selecting an arbitrary row.
  • Default membership lookup receives visible candidate scope ids as a typed array parameter and performs canonical collection membership before its uniqueness check.
  • Returned canonical observations are mapped to the existing Identity record types through ShapeMappingContext.

Fail-Closed Evaluation

Identity directory results are accepted only when canonical evaluation succeeds conclusively and returns the exact demanded rows branch, expected graph-qualified shape, complete rows, string observation identities, and object payloads that can be mapped to the requested record type. Failed or incomplete evaluation, a foreign outcome, unexpected result structure, ambiguous single-row data, or mapping failure throws IdentityDirectoryEvaluationException. Cancellation remains OperationCanceledException and is propagated without being converted into an identity failure.

This boundary deliberately does not treat partial evidence as authorization data. The exception retains the exact RelationQueryEvaluation and any returned RelationQueryEvaluationOutcome, including attributable compiler, realization, planning, and execution diagnostics.

  • Cohesive.Adapters.AspNet for request identity and API scope policy enforcement.
  • Cohesive.Api for scope-aware API declarations.
  • Cohesive.Relations for canonical query authoring, compilation, evaluation, and diagnostics.
  • Cohesive.Storage for entity-backed source registration and evaluator construction.
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 Cohesive.Identity:

Package Downloads
Cohesive.Adapters.AspNet

Cohesive semantic system definition and orchestration building blocks.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.5 51 7/20/2026
0.1.0-alpha.4 65 7/13/2026
0.1.0-alpha.3 63 7/8/2026
0.1.0-alpha.2 62 7/7/2026