Soenneker.Blazor.Auth.RolesPrincipalFactory
4.0.432
Prefix Reserved
dotnet add package Soenneker.Blazor.Auth.RolesPrincipalFactory --version 4.0.432
NuGet\Install-Package Soenneker.Blazor.Auth.RolesPrincipalFactory -Version 4.0.432
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="4.0.432" />
<PackageVersion Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="4.0.432" />
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" />
paket add Soenneker.Blazor.Auth.RolesPrincipalFactory --version 4.0.432
#r "nuget: Soenneker.Blazor.Auth.RolesPrincipalFactory, 4.0.432"
#:package Soenneker.Blazor.Auth.RolesPrincipalFactory@4.0.432
#addin nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=4.0.432
#tool nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=4.0.432
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.452)
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.432 | 0 | 9/9/2026 |
| 4.0.431 | 0 | 9/8/2026 |
| 4.0.430 | 36 | 9/8/2026 |
| 4.0.429 | 40 | 9/8/2026 |
| 4.0.428 | 44 | 9/8/2026 |
| 4.0.427 | 46 | 9/8/2026 |
| 4.0.426 | 48 | 9/7/2026 |
| 4.0.425 | 52 | 9/5/2026 |
| 4.0.424 | 49 | 9/5/2026 |
| 4.0.423 | 52 | 9/4/2026 |
| 4.0.422 | 48 | 9/4/2026 |
| 4.0.421 | 51 | 9/4/2026 |
| 4.0.420 | 55 | 9/4/2026 |
| 4.0.419 | 49 | 9/4/2026 |
| 4.0.418 | 78 | 9/4/2026 |
| 4.0.417 | 84 | 9/1/2026 |
| 4.0.416 | 79 | 9/1/2026 |
| 4.0.415 | 91 | 8/31/2026 |
| 4.0.414 | 85 | 8/31/2026 |
| 4.0.413 | 86 | 8/31/2026 |
Updated Soenneker.Extensions.IIdentity to 4.0.452