+ {
+ new Claim(ClaimTypes.Name, username),
+ new Claim("test-claim", "Test claim value"),
+ };
+
+ context.User = new ClaimsPrincipal(new ClaimsIdentity(claims, "FakeAuthenticationType"));
+ }
+
+ return next();
+ });
+ }
+
private static void MapEnhancedNavigationEndpoints(IEndpointRouteBuilder endpoints)
{
// Used when testing that enhanced nav can show non-HTML responses (which it does by doing a full navigation)
diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/InteractiveAuthenticationState.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/InteractiveAuthenticationState.razor
new file mode 100644
index 000000000000..77199f976abb
--- /dev/null
+++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/InteractiveAuthenticationState.razor
@@ -0,0 +1,30 @@
+@page "/auth/interactive-authentication-state"
+@attribute [RenderModeServer]
+@inject NavigationManager Nav
+@using BasicTestApp.AuthTest
+
+Interactive authentication state
+
+
+
+ Interactive:
+ @_interactive
+
+
+
+
+Log in |
+Log out
+
+@code {
+ bool _interactive = false;
+
+ protected override void OnAfterRender(bool firstRender)
+ {
+ if (firstRender)
+ {
+ _interactive = true;
+ StateHasChanged();
+ }
+ }
+}
diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/StaticAuthenticationState.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/StaticAuthenticationState.razor
new file mode 100644
index 000000000000..b374bf50bab7
--- /dev/null
+++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Auth/StaticAuthenticationState.razor
@@ -0,0 +1,11 @@
+@page "/auth/static-authentication-state"
+@inject NavigationManager Nav
+@using BasicTestApp.AuthTest
+
+Static authentication state
+
+
+
+
+Log in |
+Log out