From 11bd097dc342b63c9cf72fad40a8d79556852a42 Mon Sep 17 00:00:00 2001
From: Delvian Valentine
Date: Thu, 11 Sep 2025 00:21:10 +0200
Subject: [PATCH 1/4] Delete duplicate new Movie object (#36089)
---
.../sample/RazorPagesMovie90/Models/SeedData.cs | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Models/SeedData.cs b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Models/SeedData.cs
index 72cad5065bbb..8ccae189cdb2 100644
--- a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Models/SeedData.cs
+++ b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Models/SeedData.cs
@@ -34,15 +34,6 @@ public static void Initialize(IServiceProvider serviceProvider)
Rating = "R"
},
- new Movie
- {
- Title = "When Harry Met Sally",
- ReleaseDate = DateTime.Parse("1989-2-12"),
- Genre = "Romantic Comedy",
- Price = 7.99M,
- Rating = "R"
- },
-
new Movie
{
Title = "Ghostbusters ",
From 22c7e1a370e769eeba7861901375485b49a4036e Mon Sep 17 00:00:00 2001
From: Delvian Valentine
Date: Thu, 11 Sep 2025 00:48:33 +0200
Subject: [PATCH 2/4] Add description term element for Rating field (#36090)
---
.../sample/RazorPagesMovie90/Pages/Movies/Details.cshtml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Pages/Movies/Details.cshtml b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Pages/Movies/Details.cshtml
index da3cce998a77..2758850085f4 100644
--- a/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Pages/Movies/Details.cshtml
+++ b/aspnetcore/tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie90/Pages/Movies/Details.cshtml
@@ -35,6 +35,9 @@
@Html.DisplayFor(model => model.Movie.Price)
+
+ @Html.DisplayNameFor(model => model.Movie.Rating)
+
@Html.DisplayFor(model => model.Movie.Rating)
From d4c41c59c61d1fa668b4c5e0f2a9a6dc5688bb6d Mon Sep 17 00:00:00 2001
From: Luke Latham <1622880+guardrex@users.noreply.github.com>
Date: Thu, 11 Sep 2025 15:34:27 -0400
Subject: [PATCH 3/4] Improved `UserClaims` component (#36097)
---
...zor-web-app-with-windows-authentication.md | 69 ++++++++++++++++---
1 file changed, 58 insertions(+), 11 deletions(-)
diff --git a/aspnetcore/blazor/security/blazor-web-app-with-windows-authentication.md b/aspnetcore/blazor/security/blazor-web-app-with-windows-authentication.md
index 0268b5e19377..a8120b0a1aee 100644
--- a/aspnetcore/blazor/security/blazor-web-app-with-windows-authentication.md
+++ b/aspnetcore/blazor/security/blazor-web-app-with-windows-authentication.md
@@ -5,7 +5,7 @@ description: Learn how to secure a Blazor Web App with Windows Authentication.
monikerRange: '>= aspnetcore-9.0'
ms.author: wpickett
ms.custom: mvc
-ms.date: 03/25/2025
+ms.date: 09/11/2025
uid: blazor/security/blazor-web-app-windows-authentication
---
# Secure an ASP.NET Core Blazor Web App with Windows Authentication
@@ -88,32 +88,48 @@ The authorization policy is enforced by the `LocalAccountOnly` component.
```
-The `UserClaims` component lists the user's claims, which includes the user's Windows security identifiers (SIDs).
+The `UserClaims` component lists the user's claims and roles, including the user's Windows security identifiers (SIDs) with SID translations.
`Components/Pages/UserClaims.razor`:
```razor
@page "/user-claims"
@using System.Security.Claims
-@using Microsoft.AspNetCore.Authorization
-@attribute [Authorize]
+@using System.Security.Principal
+@using Microsoft.AspNetCore.Components.QuickGrid
+
+User Claims & Roles
+
+User Claims & Roles
-User Claims
+
+
+
+
+
+
+
-User Claims
+User Roles
-@if (claims.Any())
+@if (roles.Any())
{
- @foreach (var claim in claims)
+ @foreach (var role in roles)
{
- - @claim.Type: @claim.Value
+ - @role
}
}
+else
+{
+ No roles available.
+}
@code {
- private IEnumerable claims = [];
+ private IQueryable claims = Enumerable.Empty().AsQueryable();
+ private IEnumerable roles = Enumerable.Empty();
+ PaginationState pagination = new PaginationState { ItemsPerPage = 10 };
[CascadingParameter]
private Task? AuthState { get; set; }
@@ -126,7 +142,38 @@ The `UserClaims` component lists the user's claims, which includes the user's Wi
}
var authState = await AuthState;
- claims = authState.User.Claims;
+
+ claims = authState.User.Claims.AsQueryable();
+
+ roles = authState.User.Claims
+ .Where(claim => claim.Type == ClaimTypes.Role)
+ .Select(claim => claim.Value);
+ }
+
+ private string GetClaimAsHumanReadable(Claim claim)
+ {
+ if (!OperatingSystem.IsWindows() ||
+ claim.Type is not (ClaimTypes.PrimarySid or ClaimTypes.PrimaryGroupSid
+ or ClaimTypes.GroupSid))
+ {
+ // We're either not on Windows or not dealing with a SID Claim that
+ // can be translated
+ return string.Empty;
+ }
+
+ SecurityIdentifier sid = new SecurityIdentifier(claim.Value);
+
+ try
+ {
+ // Throw an exception if the SID can't be translated
+ var account = sid.Translate(typeof(NTAccount));
+
+ return account.ToString();
+ }
+ catch (IdentityNotMappedException)
+ {
+ return "Could not be mapped";
+ }
}
}
```
From 137a70d86c55280377dc77ba4ab095035db501de Mon Sep 17 00:00:00 2001
From: The Bearodactyl
Date: Thu, 11 Sep 2025 15:57:12 -0500
Subject: [PATCH 4/4] Update first-web-api.md (#36098)
---
aspnetcore/tutorials/first-web-api.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aspnetcore/tutorials/first-web-api.md b/aspnetcore/tutorials/first-web-api.md
index 50a12500dbe0..25f8223fff51 100644
--- a/aspnetcore/tutorials/first-web-api.md
+++ b/aspnetcore/tutorials/first-web-api.md
@@ -79,7 +79,7 @@ A NuGet package must be added to support the database used in this tutorial.
dotnet new webapi --use-controllers -o TodoApi
cd TodoApi
dotnet add package Microsoft.EntityFrameworkCore.InMemory
- code -r ../TodoApi
+ code -r .
```
These commands: