Lyo.Authentication.Postgres
2.0.1
dotnet add package Lyo.Authentication.Postgres --version 2.0.1
NuGet\Install-Package Lyo.Authentication.Postgres -Version 2.0.1
<PackageReference Include="Lyo.Authentication.Postgres" Version="2.0.1" />
<PackageVersion Include="Lyo.Authentication.Postgres" Version="2.0.1" />
<PackageReference Include="Lyo.Authentication.Postgres" />
paket add Lyo.Authentication.Postgres --version 2.0.1
#r "nuget: Lyo.Authentication.Postgres, 2.0.1"
#:package Lyo.Authentication.Postgres@2.0.1
#addin nuget:?package=Lyo.Authentication.Postgres&version=2.0.1
#tool nuget:?package=Lyo.Authentication.Postgres&version=2.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, 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 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 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.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)Lyo.Authentication.Models(transitive, lyo)Lyo.Common.Metadata(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.Configuration.Binder10.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.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 (>= 2.0.0)
- Lyo.Common.Core (>= 2.0.0)
- Lyo.EntityReference.Models (>= 2.0.0)
- Lyo.EntityReference.Postgres (>= 2.0.0)
- Lyo.Exceptions (>= 2.0.0)
- Lyo.Health (>= 2.0.0)
- Lyo.Postgres (>= 2.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
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.