Lyo.Authentication.Postgres
1.0.1
dotnet add package Lyo.Authentication.Postgres --version 1.0.1
NuGet\Install-Package Lyo.Authentication.Postgres -Version 1.0.1
<PackageReference Include="Lyo.Authentication.Postgres" Version="1.0.1" />
<PackageVersion Include="Lyo.Authentication.Postgres" Version="1.0.1" />
<PackageReference Include="Lyo.Authentication.Postgres" />
paket add Lyo.Authentication.Postgres --version 1.0.1
#r "nuget: Lyo.Authentication.Postgres, 1.0.1"
#:package Lyo.Authentication.Postgres@1.0.1
#addin nuget:?package=Lyo.Authentication.Postgres&version=1.0.1
#tool nuget:?package=Lyo.Authentication.Postgres&version=1.0.1
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 withtenant_id = NULLand reads filter to system rows.SingleTenantDefault(default) — caller value, falling back toTenancy.DefaultTenantIdthenEntityRefOptions.DefaultTenantId.MultiTenantStrict— caller must supply a non-emptytenantId; otherwise the store throwsArgumentNullException(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.EntityFrameworkCore10.0.5— (direct, microsoft)Microsoft.EntityFrameworkCore.Design10.0.5— (direct, microsoft)Microsoft.Extensions.Configuration.Binder10.0.5— (direct, microsoft)Lyo.Authentication.Models— (transitive, lyo)Lyo.Hashing— (transitive, lyo)Lyo.KeyStore— (transitive, lyo)BouncyCastle.Cryptography2.6.2— (transitive, third-party)Konscious.Security.Cryptography.Argon21.3.1— (transitive, third-party)Microsoft.Bcl.AsyncInterfaces10.0.5— (transitive, microsoft, netstandard2.0)Microsoft.EntityFrameworkCore.Relational10.0.5— (transitive, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (transitive, microsoft, net10.0, netstandard2.0)Microsoft.Extensions.Hosting.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Options10.0.5— (transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)Npgsql.EntityFrameworkCore.PostgreSQL10.0.3— (transitive, third-party)System.IO.Hashing10.0.5— (transitive, microsoft, net10.0)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)
| 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
- Lyo.Authentication (>= 1.0.1)
- Lyo.Common (>= 1.0.1)
- Lyo.EntityReference.Models (>= 1.0.1)
- Lyo.EntityReference.Postgres (>= 1.0.1)
- Lyo.Exceptions (>= 1.0.1)
- Lyo.Health (>= 1.0.1)
- Lyo.Postgres (>= 1.0.1)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
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.