Soenneker.Blazor.Auth.RolesPrincipalFactory 4.0.452

Prefix Reserved
dotnet add package Soenneker.Blazor.Auth.RolesPrincipalFactory --version 4.0.452
                    
NuGet\Install-Package Soenneker.Blazor.Auth.RolesPrincipalFactory -Version 4.0.452
                    
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.RolesPrincipalFactory" Version="4.0.452" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" Version="4.0.452" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Auth.RolesPrincipalFactory" />
                    
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.RolesPrincipalFactory --version 4.0.452
                    
#r "nuget: Soenneker.Blazor.Auth.RolesPrincipalFactory, 4.0.452"
                    
#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.RolesPrincipalFactory@4.0.452
                    
#: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.RolesPrincipalFactory&version=4.0.452
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Auth.RolesPrincipalFactory&version=4.0.452
                    
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.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 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.452 45 9/17/2026
4.0.451 46 9/16/2026
4.0.450 45 9/16/2026
4.0.449 48 9/16/2026
4.0.448 48 9/16/2026
4.0.447 45 9/16/2026
4.0.446 50 9/15/2026
4.0.445 47 9/15/2026
4.0.444 71 9/13/2026
4.0.443 61 9/13/2026
4.0.442 58 9/13/2026
4.0.441 60 9/13/2026
4.0.440 63 9/13/2026
4.0.439 58 9/13/2026
4.0.438 63 9/12/2026
4.0.437 64 9/12/2026
4.0.436 61 9/12/2026
4.0.435 61 9/12/2026
4.0.434 94 9/10/2026
4.0.433 96 9/9/2026
Loading failed

Updated Multiple NuGet packages