Soenneker.Blazor.Auth.RolesPrincipalFactory
4.0.451
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Blazor.Auth.RolesPrincipalFactory --version 4.0.451
NuGet\Install-Package Soenneker.Blazor.Auth.RolesPrincipalFactory -Version 4.0.451
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="4.0.451" />
<PackageVersion Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="4.0.451" />
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" />
paket add Soenneker.Blazor.Auth.RolesPrincipalFactory --version 4.0.451
#r "nuget: Soenneker.Blazor.Auth.RolesPrincipalFactory, 4.0.451"
#:package Soenneker.Blazor.Auth.RolesPrincipalFactory@4.0.451
#addin nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=4.0.451
#tool nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=4.0.451
Soenneker.Blazor.Auth.RolesPrincipalFactory
A Blazor WebAssembly account principal factory that maps a comma-separated jobTitle claim to standard .NET role claims.
Installation
dotnet add package Soenneker.Blazor.Auth.RolesPrincipalFactory
Registration
Register the factory on the authentication builder returned by AddMsalAuthentication:
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Soenneker.Blazor.Auth.RolesPrincipalFactory;
builder.Services
.AddMsalAuthentication(options =>
{
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
})
.AddAccountClaimsPrincipalFactory<RolesPrincipalFactory>();
Do not also register another account claims principal factory; the last factory registration controls principal creation.
Mapping behavior
Given this claim:
jobTitle = Administrator, Billing.Read
the factory adds ClaimTypes.Role claims for Administrator and Billing.Read. Empty comma-delimited segments are ignored, surrounding whitespace is trimmed, and casing is preserved.
The resulting principal works with normal Blazor role checks:
<AuthorizeView Roles="Administrator">
<Authorized>
<AdminDashboard />
</Authorized>
</AuthorizeView>
bool isAdministrator = user.IsInRole("Administrator");
Only use this mapping when the identity provider treats jobTitle as an authorization-controlled value. A normal profile job title is usually descriptive data, and promoting it to a role can grant unintended access. For Microsoft Entra app roles emitted through the roles claim, use Soenneker.Blazor.Auth.EntraRolesPrincipalFactory instead.
| 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.471)
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.490 | 130 | 10/15/2026 |
| 4.0.489 | 70 | 10/15/2026 |
| 4.0.488 | 68 | 10/14/2026 |
| 4.0.487 | 72 | 10/14/2026 |
| 4.0.485 | 70 | 10/14/2026 |
| 4.0.484 | 74 | 10/14/2026 |
| 4.0.483 | 74 | 10/14/2026 |
| 4.0.477 | 73 | 10/13/2026 |
| 4.0.476 | 85 | 10/12/2026 |
| 4.0.474 | 86 | 10/12/2026 |
| 4.0.473 | 78 | 10/12/2026 |
| 4.0.472 | 81 | 10/12/2026 |
| 4.0.470 | 91 | 10/11/2026 |
| 4.0.469 | 205 | 9/30/2026 |
| 4.0.468 | 88 | 9/30/2026 |
| 4.0.467 | 99 | 9/30/2026 |
| 4.0.466 | 96 | 9/30/2026 |
| 4.0.465 | 91 | 9/30/2026 |
| 4.0.464 | 95 | 9/29/2026 |
| 4.0.451 | 104 | 9/16/2026 |
Updated Soenneker.Extensions.IIdentity to 4.0.471