TrustIdentity.Storage
1.0.2
dotnet add package TrustIdentity.Storage --version 1.0.2
NuGet\Install-Package TrustIdentity.Storage -Version 1.0.2
<PackageReference Include="TrustIdentity.Storage" Version="1.0.2" />
<PackageVersion Include="TrustIdentity.Storage" Version="1.0.2" />
<PackageReference Include="TrustIdentity.Storage" />
paket add TrustIdentity.Storage --version 1.0.2
#r "nuget: TrustIdentity.Storage, 1.0.2"
#:package TrustIdentity.Storage@1.0.2
#addin nuget:?package=TrustIdentity.Storage&version=1.0.2
#tool nuget:?package=TrustIdentity.Storage&version=1.0.2
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 configurationsClientScopes- Client allowed scopesClientRedirectUris- Redirect URIsClientSecrets- Client secretsIdentityResources- OIDC identity resourcesIdentityClaims- Identity resource claimsApiScopes- OAuth 2.0 scopesApiScopeClaims- API scope claimsApiResources- Protected APIsApiResourceScopes- API resource scopes
Operational Tables
PersistedGrants- Tokens, codes, consentsDeviceFlowCodes- Device flow codesKeys- Signing keysServerSideSessions- 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
- Database Setup Guide - Complete database setup
- Setup Guide - General setup
๐ License
Apache 2.0 - See LICENSE
| 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. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.2)
- Microsoft.EntityFrameworkCore.Sqlite (>= 10.0.2)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.2)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 10.0.0)
- TrustIdentity.Abstractions (>= 1.0.2)
- TrustIdentity.Core (>= 1.0.2)
- TrustIdentity.Licensing (>= 1.0.2)
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.AdminApi
Administrative API for TrustIdentity Server. |
|
|
TrustIdentity.Admin
Complete administration interface for TrustIdentity - Manage clients, resources, users, and security settings. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- 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.