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
<PackageReference Include="Soenneker.Blazor.Auth.EntraRolesPrincipalFactory" Version="4.0.365" />
<PackageVersion Include="Soenneker.Blazor.Auth.EntraRolesPrincipalFactory" Version="4.0.365" />
<PackageReference Include="Soenneker.Blazor.Auth.EntraRolesPrincipalFactory" />
paket add Soenneker.Blazor.Auth.EntraRolesPrincipalFactory --version 4.0.365
#r "nuget: Soenneker.Blazor.Auth.EntraRolesPrincipalFactory, 4.0.365"
#:package Soenneker.Blazor.Auth.EntraRolesPrincipalFactory@4.0.365
#addin nuget:?package=Soenneker.Blazor.Auth.EntraRolesPrincipalFactory&version=4.0.365
#tool nuget:?package=Soenneker.Blazor.Auth.EntraRolesPrincipalFactory&version=4.0.365
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 | Versions 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. |
-
net10.0
- Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 10.0.12)
- Soenneker.Extensions.IIdentity (>= 4.0.454)
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 |
Update dependency Soenneker.Extensions.IIdentity to 4.0.454 (#1051)