NPv.Auth.AspNetCore 0.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NPv.Auth.AspNetCore --version 0.5.0
                    
NuGet\Install-Package NPv.Auth.AspNetCore -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.AspNetCore" 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.AspNetCore" Version="0.5.0" />
                    
Directory.Packages.props
<PackageReference Include="NPv.Auth.AspNetCore" />
                    
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.AspNetCore --version 0.5.0
                    
#r "nuget: NPv.Auth.AspNetCore, 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.AspNetCore@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.AspNetCore&version=0.5.0
                    
Install as a Cake Addin
#tool nuget:?package=NPv.Auth.AspNetCore&version=0.5.0
                    
Install as a Cake Tool

NPv.Auth.AspNetCore

ASP.NET Core host integration for NPv authentication realms.

The package provides Minimal API auth endpoints, secure auth-cookie handling, claims helpers, and dependency-injection registration for the application workflows in NPv.Auth.Application.

Status

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

Installation

dotnet add package NPv.Auth.AspNetCore

Register a realm during application startup and map its endpoints in the host:

services.AddAuthRealm<Account, EmailConfirmation, PasswordRecovery, RefreshToken>(
    new AuthRealmOptions
    {
        Name = "admin",
        Path = "/api/admin/auth",
        ClientBaseUrl = "https://admin.example.com",
        RefreshCookieName = "a_rt",
        DeviceCookieName = "a_di"
    });
app.MapAuthRealm<Account>();

The host remains responsible for authentication middleware, authorization, configuration values, persistence registration, and database migrations.

For custom entities, follow the Domain contract and EF contract. The example assumes these consumer-defined types and host dependencies exist.

Repeat registration and endpoint mapping for each distinct account type, using unique realm names and separate endpoint paths and cookie names. The registry requires unique account types and names; registering one account type under multiple names does not create separate user pools.

ConfigurationKey defaults to Name. AddAuthRealm binds registration options from Auth:Realms:{ConfigurationKey}:Registration; the host supplies other AuthRealmOptions values explicitly, including ClientBaseUrl. See the Application README for email-link configuration. Use AddAuthClaimsProvider<TAccount, TProvider>() to replace the default claims provider.

Starting with 0.5.0, AddAuthRealm also registers ICommand<ProvisionConfirmedAuthAccountCommandContext<TAccount>> with ProvisionConfirmedAuthAccountCommand<TAccount> as a transient service. The host authorizes the caller and invokes it through the standard CQS/UoW executor; no provisioning HTTP endpoint is mapped. This supports confirmed account creation even when public registration is disabled. Dependencies and caller obligations are defined in the Application provisioning contract.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 0 9/13/2026
0.5.0 0 9/13/2026
0.4.0 129 8/17/2026
0.3.1 106 8/6/2026
0.3.0 99 8/6/2026
0.2.1 95 8/5/2026
0.2.0 117 8/3/2026
0.1.0 107 8/1/2026