NuvTools.Security.Identity.AspNetCore 10.3.12

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

NuvTools.Security.Identity

NuGet License

A modular library suite for ASP.NET Identity integration targeting .NET 8, .NET 9, and .NET 10. Provides identity models, permission-based authorization, user management services, and Entity Framework Core persistence.

Libraries

Library Description NuGet
NuvTools.Security.Identity.Models Base models, form DTOs, and API models with localized validation NuGet
NuvTools.Security.Identity Permission-based authorization with dynamic policy provider NuGet
NuvTools.Security.Identity.AspNetCore User management service with email/password workflows and role administration NuGet
NuvTools.Security.Identity.EntityFrameworkCore Identity DbContext with transaction management and batch operations NuGet

Installation

dotnet add package NuvTools.Security.Identity.Models
dotnet add package NuvTools.Security.Identity
dotnet add package NuvTools.Security.Identity.AspNetCore
dotnet add package NuvTools.Security.Identity.EntityFrameworkCore

NuvTools.Security.Identity.Models

Base models, form DTOs, and API response models for ASP.NET Identity.

Key Components:

  • UserBase<TKey> -- Abstract user entity extending IdentityUser<TKey> with Email, Name, Surname, Status, and password validation (6-40 chars, min 1 uppercase, 1 lowercase, 1 digit)
  • RoleBase<TKey> -- Abstract role entity extending IdentityRole<TKey> with Name and Claims
  • Form models: LoginForm, UserForm, UserWithPasswordForm, ChangePasswordForm, ForgotPasswordForm, ResetPasswordForm, UpdateProfileForm
  • API models: TokenResponse, RefreshTokenRequest
  • UserRoles -- DTO for user-role associations

Usage:

using NuvTools.Security.Identity.Models;

public class ApplicationUser : UserBase<Guid>
{
    // Add custom properties if needed
}

public class RegistrationDto : UserWithPasswordForm
{
    // Inherits Email, Name, Surname, Password, ConfirmPassword
    // with localized validation and password complexity requirements
}

NuvTools.Security.Identity

Permission-based authorization with dynamic policy provider and claim-based permission handler.

Key Components:

  • AuthorizationPermissionPolicyProvider -- Dynamically generates policies for names starting with "Permission."
  • PermissionRequirement -- Authorization requirement carrying a permission string
  • PermissionAuthorizationHandler -- Validates permission claims with issuer "LOCAL AUTHORITY"

Usage:

using NuvTools.Security.Identity.Policy;

// Configure in Program.cs
builder.Services.AddSingleton<IAuthorizationPolicyProvider, AuthorizationPermissionPolicyProvider>();
builder.Services.AddSingleton<IAuthorizationHandler, PermissionAuthorizationHandler>();

// Protect endpoints with permissions
[Authorize(Policy = "Permission.Users.Create")]
public IActionResult CreateUser() { }

NuvTools.Security.Identity.AspNetCore

Server-side user management service and role administration. All methods return IResult / IResult<T> from the ResultWrapper pattern.

Key Components:

  • UserServiceBase<TUser, TRole, TKey> -- Abstract service with user CRUD, email confirmation/change, password management, and role operations
  • RoleManagerExtensions -- Extension methods for adding claims and permission claims to roles

Available Operations:

  • User CRUD: GetAllAsync, GetAsync, GetByEmailAsync, CreateAsync, UpdateAsync, DeleteAsync
  • User with roles: CreateWithRolesAsync, GetRolesAsync, UpdateRolesAsync
  • Email: GenerateEmailConfirmationTokenAsync, GenerateEmailConfirmationUriAsync, ConfirmEmailAsync, RequestChangeEmailUrlAsync, ChangeEmailAsync
  • Password: ChangePasswordAsync, RequestResetPasswordUrlAsync, ResetPasswordAsync
  • Status: ToggleUserStatusAsync

Usage:

using NuvTools.Security.Identity.AspNetCore.Services;
using NuvTools.Security.Identity.AspNetCore.Extensions;

public class UserService : UserServiceBase<ApplicationUser, ApplicationRole, Guid>
{
    public UserService(UserManager<ApplicationUser> userManager)
        : base(userManager) { }
}

// Add permission claims to roles
await roleManager.AddPermissionClaims(adminRole,
    "Permission.Users.Create",
    "Permission.Users.Read",
    "Permission.Users.Update",
    "Permission.Users.Delete"
);

NuvTools.Security.Identity.EntityFrameworkCore

Entity Framework Core persistence layer with transaction management and batch operations.

Key Components:

  • IdentityDbContextBase<TUser, TRole, TIdentityKey> -- Abstract DbContext extending IdentityDbContext, implementing IDbContextCommands and IDbContextWithListCommands
  • Transaction management: BeginTransactionAsync, CommitTransactionAsync, RollbackTransactionAsync
  • Execution strategy: ExecuteWithStrategyAsync
  • CRUD: AddAndSaveAsync, UpdateAndSaveAsync, RemoveAndSaveAsync
  • Batch operations: SyncFromListAsync, AddOrUpdateFromListAsync, AddOrRemoveFromListAsync

Usage:

using NuvTools.Security.Identity.EntityFrameworkCore;

public class ApplicationDbContext : IdentityDbContextBase<ApplicationUser, ApplicationRole, Guid>
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options) { }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);
        // Configure your entities
    }
}

Building

This solution uses the .slnx (XML-based solution) format.

dotnet build NuvTools.Security.Identity.slnx
dotnet build NuvTools.Security.Identity.slnx -c Release

Releasing

Publishing to nuget.org is irreversible per version, so the workflow makes it the last and smallest step.

One workflow per library. Each package has its own, so a run and an approval each concern exactly one package. The steps themselves are shared, in the reusable package-publish.yml.

Package Workflow Release tag
NuvTools.Security.Identity.Models models-publish.yml models-vX.Y.Z
NuvTools.Security.Identity identity-publish.yml identity-vX.Y.Z
NuvTools.Security.Identity.AspNetCore aspnetcore-publish.yml aspnetcore-vX.Y.Z
NuvTools.Security.Identity.EntityFrameworkCore entityframeworkcore-publish.yml entityframeworkcore-vX.Y.Z
  1. Set the package's <Version> in its .csproj and merge it. That is the version that gets published; the workflow reads it and never computes one.
  2. Run the library's workflow by hand (Actions → Models Publish → Run workflow) with push checked.
  3. The workflow builds the solution with -warnaserror, runs the tests, takes that package only from the build output, verifies it carries its README, licence, icon, symbols and every target framework, and then waits for approval on the nuget GitHub Environment before pushing.
  4. After the push succeeds, the workflow tags the commit with the tag in the table above. The tag is a record of what is on nuget.org, never what starts a release, so it cannot exist for a version that did not get there. A run whose tag already exists stops before building: the version has been released and <Version> needs a bump.

NuvTools.Security.Identity.Models goes before NuvTools.Security.Identity.AspNetCore. The latter references it as a project, so it depends on whatever <Version> Models has in that commit. The workflow checks that version is on nuget.org and refuses to push a package whose dependency is not there yet.

That check knows a version exists, not what is in it. When Models gains a type AspNetCore uses, bump its <Version> and publish it first — otherwise AspNetCore is published against an older Models that does not have it, and fails for whoever installs it.

Versions published by hand are refused. Releases made before these workflows exist on nuget.org with no tag. Pushing one again would skip the duplicate and then tag the current commit as a release it is not, so a version that is already on nuget.org stops the run. The exception is a re-run of the same run, which is how a push that succeeded and a tag that failed gets finished.

No API key is stored. The push uses nuget.org's trusted publishing: the job presents a GitHub OIDC token, nuget.org checks it against the policy registered for this repository and answers with a key that lives for one hour. The repository needs one secret, NUGET_USER — the nuget.org profile name the policy belongs to — and the policy itself, registered under Trusted Publishing on nuget.org with the owner nuvtools, the repository nuvtools-security-identity, the workflow file and the environment nuget.

Run a library's workflow by hand with push unchecked for a dry run that stops after the verification.

Project Structure

nuvtools-security-identity/
├── src/
│   ├── NuvTools.Security.Identity.Models/
│   ├── NuvTools.Security.Identity/
│   ├── NuvTools.Security.Identity.AspNetCore/
│   └── NuvTools.Security.Identity.EntityFrameworkCore/
├── NuvTools.Security.Identity.slnx
└── README.md

License

This project is licensed under the terms specified in the LICENSE file.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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
10.3.12 39 10/11/2026
10.3.11 113 9/21/2026
10.3.0 135 8/1/2026
10.2.9 126 6/27/2026
10.1.9 129 6/27/2026
10.1.8 137 5/27/2026
10.1.7 130 5/1/2026
10.1.5 171 3/16/2026
10.1.1 132 3/7/2026
10.1.0 148 1/28/2026
10.0.0 284 12/6/2025
9.5.0 245 10/26/2025
9.2.1 197 5/24/2025
9.2.0 244 5/23/2025
9.1.1 224 4/12/2025
9.1.0 244 4/10/2025
9.0.0 220 11/13/2024
8.1.0 268 9/15/2024
8.0.4 253 4/8/2024
8.0.3 260 3/5/2024
Loading failed