Skip to content

Commit 92292c6

Browse files
committed
Update page title and authMessage string handling
Updated the title of the page in `CascadeAuthState.razor` from "Cascade Auth State" to "Authentication State and Authorization Check". The `authMessage` string now uses the user's name from the "name" claim instead of the `Identity.Name` property. Also, the wording of the `authMessage` string has been modified for both Admin and non-Admin roles, with a specific change in the phrase for non-Admin users.
1 parent 1b0de9d commit 92292c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

WebApp/Components/Pages/User/CascadeAuthState.razor

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@page "/user/cascade-auth-state"
22
@using Microsoft.AspNetCore.Components.Authorization
33

4-
<h1>Cascade Auth State</h1>
4+
<h1>Authentication State and Authorization Check</h1>
55

66
<p>@authMessage</p>
77

@@ -20,13 +20,14 @@
2020

2121
if (user?.Identity is not null && user.Identity.IsAuthenticated)
2222
{
23+
var name = user.FindFirst("name").Value;
2324
if (user.IsInRole("Admin"))
2425
{
25-
authMessage = $"{user.Identity.Name} is authenticated and in the Admin role.";
26+
authMessage = $"{name} is authenticated and in the Admin role.";
2627
}
2728
else
2829
{
29-
authMessage = $"{user.Identity.Name} is authenticated but not in the Admin role.";
30+
authMessage = $"{name} is authenticated, but not in the Admin role.";
3031
}
3132
}
3233
}

0 commit comments

Comments
 (0)