Soenneker.Blazor.Auth.EntraRolesPrincipalFactory 4.0.365

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

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Blazor.Auth.EntraRolesPrincipalFactory

A Blazor WebAssembly account principal factory that converts Microsoft Entra app roles into standard .NET role claims.

Installation

dotnet add package Soenneker.Blazor.Auth.EntraRolesPrincipalFactory

Registration

Register the factory on the authentication builder returned by AddMsalAuthentication:

using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Soenneker.Blazor.Auth.EntraRolesPrincipalFactory;

builder.Services
    .AddMsalAuthentication(options =>
    {
        builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
    })
    .AddAccountClaimsPrincipalFactory<EntraRolesPrincipalFactory>();

Do not also register another account claims principal factory; the last factory registration controls principal creation.

Role checks

For an Entra claim shaped like:

{
  "roles": ["Administrator", "Billing.Read"]
}

the factory adds one ClaimTypes.Role claim per nonblank value. Blazor authorization can then use the normal role APIs:

<AuthorizeView Roles="Administrator">
    <Authorized>
        <AdminDashboard />
    </Authorized>
</AuthorizeView>
bool isAdministrator = user.IsInRole("Administrator");

Role names are trimmed but otherwise preserved, including casing. Missing or empty roles claims add no roles. The package only maps claims already present in the authenticated account; app-role assignment and token emission remain Entra configuration concerns.

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
4.0.365 41 9/9/2026
4.0.364 42 9/9/2026
4.0.363 45 9/8/2026
4.0.362 45 9/8/2026
4.0.361 71 9/8/2026
4.0.360 70 9/8/2026
4.0.359 72 9/8/2026
4.0.358 88 9/7/2026
4.0.357 93 9/5/2026
4.0.356 82 9/5/2026
4.0.355 84 9/4/2026
4.0.354 83 9/4/2026
4.0.353 85 9/4/2026
4.0.352 85 9/4/2026
4.0.351 76 9/4/2026
4.0.350 86 9/4/2026
4.0.349 90 9/1/2026
4.0.348 85 9/1/2026
4.0.347 85 8/31/2026
4.0.346 94 8/31/2026
Loading failed

Update dependency Soenneker.Extensions.IIdentity to 4.0.454 (#1051)