Innovorium.OpenIddict.Marten
0.1.0
dotnet add package Innovorium.OpenIddict.Marten --version 0.1.0
NuGet\Install-Package Innovorium.OpenIddict.Marten -Version 0.1.0
<PackageReference Include="Innovorium.OpenIddict.Marten" Version="0.1.0" />
<PackageVersion Include="Innovorium.OpenIddict.Marten" Version="0.1.0" />
<PackageReference Include="Innovorium.OpenIddict.Marten" />
paket add Innovorium.OpenIddict.Marten --version 0.1.0
#r "nuget: Innovorium.OpenIddict.Marten, 0.1.0"
#:package Innovorium.OpenIddict.Marten@0.1.0
#addin nuget:?package=Innovorium.OpenIddict.Marten&version=0.1.0
#tool nuget:?package=Innovorium.OpenIddict.Marten&version=0.1.0
Innovorium.OpenIddict.Marten
Marten persistence for OpenIddict core on .NET 10 and PostgreSQL.
This package registers opinionated, Guid-identified Marten documents and stores for OpenIddict applications, authorizations, scopes, and tokens. Use the standard OpenIddict managers and descriptors; the package adds storage, not an identity server.
Install
dotnet add package Innovorium.OpenIddict.Marten
Review the changelog before upgrading. While the project is below 1.0, public APIs and persisted contracts may change in a minor release.
Register Marten and OpenIddict
The host owns the PostgreSQL connection and Marten lifecycle. Register Marten first, then select these stores for OpenIddict core:
using JasperFx;
using Marten;
using Microsoft.Extensions.DependencyInjection;
var connectionString = builder.Configuration.GetConnectionString("Marten")
?? throw new InvalidOperationException("ConnectionStrings:Marten is required.");
builder.Services.AddMarten(options =>
{
options.Connection(connectionString);
options.AutoCreateSchemaObjects = AutoCreate.None;
});
builder.Services.AddOpenIddict()
.AddCore(options => options.UseMarten());
UseMarten() registers the default application, authorization, scope, and token entities and their OpenIddict stores. It does not select a connection, change AutoCreateSchemaObjects, or apply database changes. Register a custom TimeProvider before UseMarten() when token pruning must use a host-controlled clock; otherwise TimeProvider.System is used.
Each database operation opens and disposes a package-owned lightweight Marten session. An OpenIddict mutation therefore cannot flush unrelated work pending in the host application's scoped IDocumentSession, and a failed operation cannot leave queued work for a later call.
Schema ownership
The host owns schema generation, review, deployment, backup, and recovery. Keep automatic production changes disabled, generate a patch from the host containing the exact Marten and OpenIddict registrations, review and apply it through your database delivery process, then assert the deployed schema:
Expose Marten's JasperFx commands in the host before builder.Build(), then use
the command runner instead of app.Run():
builder.Host.ApplyJasperFxExtensions();
// Build and map the host as usual, then:
return await app.RunJasperFxCommands(args);
dotnet run --project src/YourHost/YourHost.csproj -- db-patch schema.sql --drop schema.drop.sql
dotnet run --project src/YourHost/YourHost.csproj -- db-assert
See Marten's official command-line tooling and schema migrations and patches documentation. This package does not ship or execute migrations.
Maintenance bounds
Authorization and token revocation and pruning process rows in batches of 1,000, with a ceiling of 1,000 batches—1,000,000 matching rows—per invocation. Returned counts are the rows changed or removed by that invocation.
When prune returns 1,000,000, treat the result as potentially truncated and
invoke prune again under the host's scheduling, cancellation, load, and retry
policy. Do not blindly repeat an unfiltered revoke call: already-revoked rows
can be selected again. For more than 1,000,000 revoke targets, partition the
operation with filters that exclude completed rows, such as an applicable
status predicate, or another stable host-owned partitioning strategy.
Revocation detects revision drift between selection and update and raises an OpenIddict concurrency exception instead of revoking a record that no longer matches; retry or repartition according to the host's concurrency policy.
Scope and limits
- Supported storage: the package's single-tenanted application, authorization, scope, and token documents in the default Marten document store.
- Not supported: custom OpenIddict entity types, named Marten stores, or multi-tenant OpenIddict storage.
- Not included: OpenIddict server or validation configuration, endpoints, issuer selection, consent UI, signing or encryption credentials, client-provisioning policy, application users, or authorization policy.
- Not owned: PostgreSQL credentials, schema deployment, migrations, backups, monitoring, or recovery.
Configure OpenIddict server or validation components separately when the host needs them.
Project links
| 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
- Marten (>= 9.21.0 && < 10.0.0)
- Npgsql (>= 9.0.4 && < 10.0.0)
- OpenIddict.Core (>= 7.6.0 && < 8.0.0)
- Weasel.Storage (>= 9.17.0 && < 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 32 | 7/30/2026 |
| 0.1.0-alpha.2 | 36 | 7/30/2026 |