TrustIdentity.Storage 1.0.2

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

TrustIdentity.Storage

Entity Framework Core storage for TrustIdentity


๐Ÿ“ฆ Overview

TrustIdentity.Storage provides Entity Framework Core-based persistence for TrustIdentity, supporting multiple database providers.


๐ŸŽฏ Supported Databases

  • โœ… SQL Server
  • โœ… PostgreSQL
  • โœ… MySQL
  • โœ… SQLite
  • โœ… In-Memory (Development)

๐Ÿ“‹ Database Contexts

ConfigurationDbContext

Stores configuration data (long-lived):

  • Clients - OAuth/OIDC client applications
  • IdentityResources - OpenID Connect scopes
  • ApiScopes - OAuth 2.0 scopes
  • ApiResources - Protected APIs

PersistedGrantDbContext

Stores operational data (short-lived):

  • PersistedGrants - Authorization codes, refresh tokens
  • DeviceFlowCodes - Device flow codes
  • Keys - Signing keys
  • ServerSideSessions - Server-side sessions

๐Ÿš€ Installation

# Base package
dotnet add package TrustIdentity.Storage

# Database provider (choose one)
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL
dotnet add package Pomelo.EntityFrameworkCore.MySql
dotnet add package Microsoft.EntityFrameworkCore.Sqlite

# EF Core tools
dotnet add package Microsoft.EntityFrameworkCore.Tools

๐Ÿ”ง Usage

SQL Server

using TrustIdentity.Storage.EntityFramework.Extensions;

var connectionString = "Server=localhost;Database=TrustIdentity;User Id=sa;Password=YourPassword;TrustServerCertificate=True";

builder.Services.AddTrustIdentity(options => { ... })
    .AddConfigurationStore(options =>
        options.UseSqlServer(connectionString, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)))
    .AddOperationalStore(options =>
        options.UseSqlServer(connectionString, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)));

PostgreSQL

var connectionString = "Host=localhost;Database=trustidentity;Username=postgres;Password=YourPassword";

builder.Services.AddTrustIdentity(options => { ... })
    .AddConfigurationStore(options =>
        options.UseNpgsql(connectionString, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)))
    .AddOperationalStore(options =>
        options.UseNpgsql(connectionString, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)));

MySQL

var connectionString = "Server=localhost;Database=trustidentity;User=root;Password=YourPassword";
var serverVersion = new MySqlServerVersion(new Version(8, 0, 21));

builder.Services.AddTrustIdentity(options => { ... })
    .AddConfigurationStore(options =>
        options.UseMySql(connectionString, serverVersion, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)))
    .AddOperationalStore(options =>
        options.UseMySql(connectionString, serverVersion, sql =>
            sql.MigrationsAssembly(typeof(Program).Assembly.FullName)));

๐Ÿ”„ Migrations

Create Migrations

# Configuration store
dotnet ef migrations add InitialConfigurationDb -c ConfigurationDbContext -o Data/Migrations/Configuration

# Operational store
dotnet ef migrations add InitialPersistedGrantDb -c PersistedGrantDbContext -o Data/Migrations/PersistedGrant

Update Database

dotnet ef database update -c ConfigurationDbContext
dotnet ef database update -c PersistedGrantDbContext

๐Ÿ“Š Database Schema

Configuration Tables

  • Clients - Client configurations
  • ClientScopes - Client allowed scopes
  • ClientRedirectUris - Redirect URIs
  • ClientSecrets - Client secrets
  • IdentityResources - OIDC identity resources
  • IdentityClaims - Identity resource claims
  • ApiScopes - OAuth 2.0 scopes
  • ApiScopeClaims - API scope claims
  • ApiResources - Protected APIs
  • ApiResourceScopes - API resource scopes

Operational Tables

  • PersistedGrants - Tokens, codes, consents
  • DeviceFlowCodes - Device flow codes
  • Keys - Signing keys
  • ServerSideSessions - Server-side sessions

๐Ÿงน Token Cleanup

Enable automatic cleanup of expired tokens:

.AddOperationalStore(options =>
{
    options.UseSqlServer(connectionString);
    options.EnableTokenCleanup = true;
    options.TokenCleanupInterval = 3600; // 1 hour
})

๐Ÿ—๏ธ Architecture

TrustIdentity.Storage/
โ”œโ”€โ”€ EntityFramework/
โ”‚   โ”œโ”€โ”€ DbContexts/     # EF Core contexts
โ”‚   โ”œโ”€โ”€ Entities/       # Database entities
โ”‚   โ”œโ”€โ”€ Stores/         # Store implementations
โ”‚   โ””โ”€โ”€ Extensions/     # Configuration extensions
โ””โ”€โ”€ InMemory/          # In-memory stores (dev)

๐Ÿ“š Documentation


๐Ÿ“„ License

Apache 2.0 - See LICENSE

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 (4)

Showing the top 4 NuGet packages that depend on TrustIdentity.Storage:

Package Downloads
TrustIdentity.AspNetCore

ASP.NET Core middleware, tag helpers, and integration for TrustIdentity server.

TrustIdentity.Server

Complete Enterprise IAM Server - OAuth 2.0, OIDC, SAML, WS-Fed

TrustIdentity.Admin

Complete administration interface for TrustIdentity - Manage clients, resources, users, and security settings.

TrustIdentity.AdminApi

Administrative API for TrustIdentity Server.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 140 2/5/2026
1.0.1 115 2/4/2026
1.0.0 112 1/22/2026

- Full implementation of OAuth 2.0 and OpenID Connect 1.0.
     - Integrated SAML 2.0 and WS-Federation support.
     - Advanced AI/ML-driven fraud detection and behavioral analysis.
     - FAPI 1.0 & 2.0 (Security Profile) compliance.
     - Support for PKCE, DPoP, Mutual TLS, PAR, and JAR.
     - Entity Framework Core support for SQL Server, PostgreSQL, MySQL, and SQLite.
     - Multi-tenant isolation and Backend-for-Frontend (BFF) patterns.
     - Complete Admin UI and REST API for identity management.