Nedo.AspNet.Authentication.EntraId 2.0.9

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

Nedo.AspNet.Authentication.EntraId

Microsoft Entra ID (formerly Azure AD) as the canonical token issuer (JWT-bearer pattern). Validates Entra-issued JWTs and auto-maps Entra app-roles + group claims to ASP.NET Core's ClaimTypes.Role.

Install

dotnet add package Nedo.AspNet.Authentication.EntraId

Quickstart

using Nedo.AspNet.Authentication.EntraId;

builder.Services.AddEntraId(opts =>
{
    opts.TenantId = builder.Configuration["EntraId:TenantId"]!;
    opts.Audience = builder.Configuration["EntraId:ClientId"]!;
});

builder.Services.AddAuthorization();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<IAuthContext, AuthContext>();

var app = builder.Build();
app.UseAuthentication();
app.UseNedoAuthContext();
app.UseAuthorization();

app.MapGet("/admin", (IAuthContext auth) => auth.UserId)
   .RequireAuthorization(p => p.RequireRole("Admin.Read"));

Claims auto-mapping

Entra claim Mapped to
roles: ["Admin.Read", "Reports.Write"] (app roles) ClaimTypes.Role (one per value)
groups: ["<group-object-id>"] ClaimTypes.Role (raw GUIDs)
preferred_username ClaimTypes.Name
oid ClaimTypes.NameIdentifier
tid left as tid (often re-emitted as tenant via a custom transformer)

To translate group GUIDs to friendly role names, register an INedoClaimsTransformer from Nedo.AspNet.Authentication.Claims that maps groups → display names via Microsoft Graph or a hard-coded table.

Multi-tenant Entra apps

For an app registered as multi-tenant, set TenantId = "common" (or "organizations" / "consumers"). The validator switches to the Entra v2 multi-tenant issuer pattern and accepts tokens from any tenant your app is consented in.

Docs

docs/04-identity-providers.md — JWT-bearer pattern + Entra-specific notes.

For sign in with Microsoft Account (Microsoft consumer accounts via MSAL.js issuing your own JWTs), see Nedo.AspNet.Authentication.Microsoft — that's a different pattern (your app mints the session, Microsoft just verifies who).

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
2.0.9 89 5/11/2026
2.0.8 89 5/6/2026
2.0.7 84 5/5/2026
2.0.6 82 5/5/2026
2.0.4 82 5/4/2026
2.0.3 85 5/4/2026
2.0.2 88 5/2/2026
2.0.1 83 5/2/2026
2.0.0 90 5/1/2026