Lyo.Authentication.Postgres 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Lyo.Authentication.Postgres --version 2.0.0
                    
NuGet\Install-Package Lyo.Authentication.Postgres -Version 2.0.0
                    
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="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.Authentication.Postgres" Version="2.0.0" />
                    
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 2.0.0
                    
#r "nuget: Lyo.Authentication.Postgres, 2.0.0"
                    
#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@2.0.0
                    
#: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=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.Authentication.Postgres&version=2.0.0
                    
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, IExternalIdentityStore, IUserClaimStore, and IUserScopeStore.

Owns the [user] schema. Six 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) - [user].[claim]. Extra JWT type/value pairs (UserClaimEntity) - [user].[scope]. Authorization scopes copied onto issued JWTs (UserScopeEntity). Unique (user_id, name).

__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 six entities (UserEntity, TokenEntity, LinkedIdentityEntity, UserEventEntity, UserClaimEntity, UserScopeEntity) 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. Duplicate (UserId, Type) claim rows are allowed. Scope names are unique per user (ux_scope_user_id_name).

IUserStore, IApiTokenStore, IExternalIdentityStore, IUserClaimStore, IUserScopeStore, 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 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.Core (direct, lyo)
  • Lyo.Configuration (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)
  • Lyo.Authentication.Models (transitive, lyo)
  • Lyo.Common.Metadata (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.Configuration.Binder 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.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 (2)

Showing the top 2 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.

Lyo.Api.Authentication

Administrative HTTP API for Lyo Authentication: QueryProject user/token/claim/scope/identity/event surfaces with host-supplied EndpointAuth.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 0 9/14/2026
2.0.0 89 9/9/2026
1.0.13 100 8/25/2026
1.0.11 107 8/23/2026
1.0.9 111 8/22/2026
1.0.6 116 8/20/2026
1.0.4 118 8/20/2026
1.0.3 107 8/19/2026
1.0.2 107 8/19/2026
1.0.1 111 8/18/2026
1.0.0 115 8/16/2026