NPv.Auth.Application 0.5.0

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

NPv.Auth.Application

Application workflows for reusable NPv authentication realms.

The package provides CQS commands for self-registration, email confirmation, login, token refresh, logout, password recovery and reset, and administrative creation of confirmed accounts. It also includes realm configuration, password hashing, JWT generation, the IAuthClaimsProvider<TAccount> extension point, and an email-confirmation event handler with its email template.

HTTP endpoints and cookies belong to NPv.Auth.AspNetCore; persistence mapping belongs to NPv.Auth.Ef. This package does not create consumer-domain entities such as Actor or define their lifecycle.

Status

This package is at an early stage (0.x). Its public API and runtime behavior may change between minor versions.

Version 0.5.0 adds administrative confirmed-account provisioning and AuthErrors.EmailAlreadyExists. Existing workflow APIs are unchanged; no schema change is required.

Installation

dotnet add package NPv.Auth.Application --version 0.5.0

Applications normally consume this package through NPv.Auth.AspNetCore or a custom host adapter.

The host composes realm registrations, command bindings, the CQS/unit-of-work executor, repository and outbox implementations, and the services required by the chosen workflows. For confirmation emails it also supplies IMailSender and IEmailTemplateRenderer.

The email handler combines ClientBaseUrl with the conventional /account/register/confirm client route. A host can override AuthRealmOptions.EmailConfirmationPath only when its client uses another route.

Hosts that use assembly-scanned messaging can include AuthApplicationAssembly.Reference in their composition assembly list. This registers the standard auth event handlers without referring to their concrete types or namespaces.

Administrative provisioning

ProvisionConfirmedAuthAccountCommand<TAccount> accepts ProvisionConfirmedAuthAccountCommandContext<TAccount> with Email and Password in the NPv.Auth.Application.Registration namespace. The trusted host must authorize the caller before execution; the command performs no authorization. There is no generic HTTP endpoint for this operation.

Reference Application 0.5.0 directly to use this API. AddAuthRealm in NPv.Auth.AspNetCore 0.4.0 does not register it: the host must bind ICommand<ProvisionConfirmedAuthAccountCommandContext<TAccount>> to ProvisionConfirmedAuthAccountCommand<TAccount> and invoke it through the standard CQS/UoW executor. The command requires IGenericRepository, PasswordHasher, AuthRealmRegistry with the account type registered, and IOutbox. It returns Result, not an account or tokens.

TAccount derives from AuthAccountBase and must have a public parameterless constructor. Provisioning fills inherited auth fields only; custom required business fields remain the consumer's responsibility. See the Domain contract.

The command trims and lowercases email invariantly, validates its format and the current password contract (required, 6–16 characters) at application level, and creates an account with IsEmailConfirmed = true and IsBanned = false, ready for ordinary login and password recovery. Invalid input returns auth.invalid_credentials for the relevant property. Login does not normalize its input; supply the stored normalized email.

An existing email returns auth.email_already_exists without changing the account, password, confirmation or ban. A concurrent unique-constraint failure at commit remains an infrastructure exception handled by the host; retry finds the account through the ordinary lookup.

This use case is separate from self-registration: Registration.Enabled, AdminEmail, unconfirmed-account retries and ConfirmPassword remain part of RegisterAuthCommand. Provisioning starts no confirmation flow and creates no confirmation code, confirmation, recovery or refresh-token entity. It enqueues only AuthAccountRegisteredEvent in the outbox, with no AuthEmailConfirmationIssuedEvent or AuthAccountEmailConfirmedEvent. Consumers must not assume that registration always starts an email-confirmation flow; see the event's lifecycle semantics. It neither saves changes nor owns a transaction; the standard executor does.

Author's Note

This library grew out of my long-standing personal interest in structuring and publishing open source packages. Over time, I’ve revisited and refined earlier internal utilities and ideas, giving them a more consistent shape and preparing them for wider reuse. Along the way, I’ve also taken the opportunity to explore how open source distribution and licensing work in the .NET ecosystem.

It’s a small step toward something I’ve always wanted to try — sharing practical, minimal tools that reflect years of learning, experimentation, and refinement.

Hopefully, someone finds it useful.

Nikolai 😛

⚖️ License

MIT — you are free to use this in commercial and open-source software.

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 NPv.Auth.Application:

Package Downloads
NPv.Auth.AspNetCore

ASP.NET Core endpoints, cookie handling, claims helpers, and service registration for NPv authentication modules.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 42 9/13/2026
0.4.0 137 8/17/2026
0.3.0 131 8/6/2026
0.2.1 123 8/5/2026
0.2.0 135 8/3/2026
0.1.0 128 7/31/2026