Class DashboardAuth
Pure, side-effect-free security helpers for the dashboard's auth endpoints. Kept out of
Program.cs so the security-critical rules (path-traversal guard, open-redirect guard,
role ladder, session revalidation) are unit-testable in isolation.
public static class DashboardAuth
Inheritance
Methods
ExpandRoles(string?)
Expands a dashboard role into the privilege ladder, so a policy that requires
public static IEnumerable<string> ExpandRoles(string? role)
IsLocalUrl(string?)
Only a local, single-slash-rooted path is a safe post-login redirect target. Absolute URLs,
public static bool IsLocalUrl(string? url)
IsSafeLogFileName(string?)
A log file name is safe only when it is a bare file name: no directory separators, no
public static bool IsSafeLogFileName(string? filename)
RevalidatePrincipalAsync(CookieValidatePrincipalContext)
Cookie-side half of session revalidation (review 2026-09-02, В14): every
public static Task RevalidatePrincipalAsync(CookieValidatePrincipalContext ctx)
RolesMatch(ClaimsPrincipal, string?)
True when the principal's role claims equal the ladder expansion of role.
public static bool RolesMatch(ClaimsPrincipal principal, string? role)