refactor(dashboard): normalize auto-login user in ctor; clarify claim-shape doc; add custom-user test

This commit is contained in:
Joseph Doherty
2026-06-16 08:23:14 -04:00
parent ee1423db7a
commit 1d652b24c6
2 changed files with 18 additions and 2 deletions
@@ -34,4 +34,14 @@ public sealed class DashboardAutoLoginAuthenticationHandlerTests
Assert.Equal("multi-role", principal.Identity!.Name);
}
[Fact]
public void CreatePrincipal_CustomUser_PreservesNameAndRoles()
{
ClaimsPrincipal principal = DashboardAutoLoginAuthenticationHandler.CreatePrincipal("gw-viewer");
Assert.Equal("gw-viewer", principal.Identity!.Name);
Assert.True(principal.IsInRole(DashboardRoles.Admin));
Assert.True(principal.IsInRole(DashboardRoles.Viewer));
}
}