Lyo.Authentication.Postgres 1.0.2

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

Lyo.Authentication.Postgres

PostgreSQL persistence for Lyo.Authentication. Replaces the in-memory stores from the base lib with EF Core-backed implementations of IApiTokenStore, IUserStore, and IExternalIdentityStore.

Owns the [user] schema. Four tables in this lib:

  • [user].[user] — Lyo internal users - [user].[token] — Format-B opaque API tokens - [user].[linked_identity] — external OIDC identity links - [user].[event] — auth audit events (UserEventEntity)

__EFMigrationsHistory lives inside the [user] schema.

Examples

Register services

services.AddLyoAuthentication();
services.AddPostgresAuthenticationStoresFromConfiguration(configuration);

Register services (2)

services.AddPostgresApiTokenStoreFromConfiguration(configuration);
services.AddPostgresUserStoreFromConfiguration(configuration);
services.AddPostgresExternalIdentityStoreFromConfiguration(configuration);

Register services (3)

{
  "PostgresUser": {
    "ConnectionString": "Host=...;Database=lyo;...",
    "EnableAutoMigrations": true
  }
}

Registration

Or each store individually: appsettings.json:

Tenancy

All four entities (UserEntity, TokenEntity, LinkedIdentityEntity, UserEventEntity) carry a nullable tenant_id (uuid) column with filtered indexes (ix_<table>_tenant_id). null represents cross-tenant / system records; non-null values scope the row to a specific tenant. Unique constraints on UserEntity.Email and LinkedIdentityEntity (provider, subject) include tenant_id, so the same email or external subject can exist per tenant.

IUserStore, IApiTokenStore, IExternalIdentityStore, and PostgresAuthAuditRecorder all accept an explicit Guid? tenantId and run it through TenancyResolver.Resolve using the policy configured in PostgresUserOptions.Tenancy (inheriting from EntityRefOptions.Mode when unset):

  • SystemOnly — every row is persisted with tenant_id = NULL and reads filter to system rows.
  • SingleTenantDefault (default) — caller value, falling back to Tenancy.DefaultTenantId then EntityRefOptions.DefaultTenantId.
  • MultiTenantStrict — caller must supply a non-empty tenantId; otherwise the store throws ArgumentNullException (the audit recorder swallows and logs).

See Lyo.EntityReference.Postgres — Tenancy for the full matrix.

{
  "PostgresUser": {
    "ConnectionString": "Host=localhost;Database=auth;...",
    "Tenancy": { "Mode": "MultiTenantStrict" }
  }
}

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Authentication — (direct, lyo)
  • Lyo.Common — (direct, lyo)
  • Lyo.EntityReference.Models — (direct, lyo)
  • Lyo.EntityReference.Postgres — (direct, lyo)
  • Lyo.Exceptions — (direct, lyo)
  • Lyo.Health — (direct, lyo)
  • Lyo.Postgres — (direct, lyo)
  • Microsoft.EntityFrameworkCore 10.0.5 — (direct, microsoft)
  • Microsoft.EntityFrameworkCore.Design 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 — (direct, microsoft)
  • Lyo.Authentication.Models — (transitive, lyo)
  • Lyo.Hashing — (transitive, lyo)
  • Lyo.KeyStore — (transitive, lyo)
  • BouncyCastle.Cryptography 2.6.2 — (transitive, third-party)
  • Konscious.Security.Cryptography.Argon2 1.3.1 — (transitive, third-party)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 — (transitive, microsoft, netstandard2.0)
  • Microsoft.EntityFrameworkCore.Relational 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (transitive, microsoft, net10.0, netstandard2.0)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options 10.0.5 — (transitive, microsoft)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 — (transitive, microsoft)
  • Npgsql.EntityFrameworkCore.PostgreSQL 10.0.3 — (transitive, third-party)
  • System.IO.Hashing 10.0.5 — (transitive, microsoft, net10.0)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 — (transitive, microsoft, netstandard2.0)
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 Lyo.Authentication.Postgres:

Package Downloads
Lyo.Config.Api

Central HTTP API exposing Lyo.Config PostgreSQL-backed IConfigStore for microservices (polling-friendly ETags). Embed via AddConfigApi / MapConfigApiEndpoints.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 0 8/19/2026
1.0.1 31 8/18/2026
1.0.0 61 8/16/2026