Soenneker.Blazor.Auth.RolesPrincipalFactory
11.0.516
Prefix Reserved
dotnet add package Soenneker.Blazor.Auth.RolesPrincipalFactory --version 11.0.516
NuGet\Install-Package Soenneker.Blazor.Auth.RolesPrincipalFactory -Version 11.0.516
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="11.0.516" />
<PackageVersion Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="11.0.516" />
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" />
paket add Soenneker.Blazor.Auth.RolesPrincipalFactory --version 11.0.516
#r "nuget: Soenneker.Blazor.Auth.RolesPrincipalFactory, 11.0.516"
#:package Soenneker.Blazor.Auth.RolesPrincipalFactory@11.0.516
#addin nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=11.0.516
#tool nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=11.0.516
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 | net11.0 is compatible. |
-
net11.0
- Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 11.0.0)
- Soenneker.Extensions.IIdentity (>= 11.0.540)
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 |
|---|---|---|
| 11.0.516 | 98 | 11/19/2026 |
| 11.0.515 | 94 | 11/19/2026 |
| 11.0.513 | 98 | 11/15/2026 |
| 11.0.512 | 100 | 11/15/2026 |
| 11.0.510 | 118 | 11/11/2026 |
| 11.0.509 | 104 | 11/11/2026 |
| 11.0.507 | 105 | 11/11/2026 |
| 11.0.506 | 102 | 11/11/2026 |
| 11.0.505 | 95 | 11/11/2026 |
| 11.0.504 | 69 | 11/10/2026 |
| 11.0.503 | 138 | 11/3/2026 |
| 11.0.502 | 65 | 11/3/2026 |
| 11.0.501 | 71 | 11/3/2026 |
| 11.0.500 | 71 | 11/3/2026 |
| 11.0.499 | 100 | 10/29/2026 |
| 11.0.498 | 75 | 10/27/2026 |
| 11.0.497 | 69 | 10/26/2026 |
| 11.0.495 | 65 | 10/26/2026 |
| 11.0.494 | 68 | 10/26/2026 |
| 11.0.493 | 67 | 10/26/2026 |
Updated Soenneker.Extensions.IIdentity to 11.0.540