namespace ZB.MOM.WW.MxGateway.Server.Dashboard; public static class DashboardAuthenticationDefaults { /// Cookie scheme used to authenticate interactive dashboard requests. public const string AuthenticationScheme = "MxGateway.Dashboard"; /// /// Bearer scheme used to authenticate SignalR hub connections. Hubs cannot /// reuse the browser's HttpOnly cookie when the client SignalR JS resolves /// the cookie scope to loopback, so the dashboard mints a short-lived /// data-protected bearer token on demand. /// public const string HubAuthenticationScheme = "MxGateway.Dashboard.HubToken"; /// /// Policy guarding read-only dashboard pages. Allowed roles: /// or . /// public const string ViewerPolicy = "MxGateway.Dashboard.Viewer"; /// /// Policy guarding write-capable dashboard pages and admin endpoints /// (API-key CRUD, settings edits, hub publishes). Allowed role: /// . /// public const string AdminPolicy = "MxGateway.Dashboard.Admin"; /// /// Policy attached to SignalR hubs — accepts either the cookie scheme /// (in-page connect) or the hub-token bearer scheme (cross-origin or /// WebSocket connect where the cookie can't be forwarded). /// public const string HubClientsPolicy = "MxGateway.Dashboard.HubClients"; /// /// Policy guarding the alarm feed — the AlarmsHub SignalR surface and the /// /alarms page that reads the same central monitor in process. Accepts the /// same two schemes as but carries /// , a requirement type /// does not handle, so the environment bypasses /// (Authentication:Mode=Disabled and anonymous localhost) cannot satisfy it. The alarm /// feed is galaxy-wide and session-less, so unlike a session event stream there is no tag /// intersection to narrow it with — requiring a real role claim is the available narrowing. /// public const string AlarmsPolicy = "MxGateway.Dashboard.Alarms"; public const string LdapGroupClaimType = "mxgateway:ldap_group"; public const string KeyPrefixClaimType = "mxgateway:key_prefix"; /// /// Claim carrying one dashboard event-visibility tag the caller is granted. Stamped /// at cookie login by and at hub-token mint by /// , both resolving the caller's LDAP groups through /// MxGateway:Dashboard:GroupToTag. reads /// this claim only as a FALLBACK, for a principal that carries no /// claims to re-resolve from (the hub-token principal, whose /// payload carries tags but not groups); a cookie principal is re-resolved against current /// options instead, so a stamped tag cannot outlive a config-revoked grant. A principal /// carrying neither kind of claim is an empty-grant Viewer, which is the fail-closed default. /// Visibility only — it never grants data access. /// public const string DashboardTagClaimType = "zb:dashboardtag"; /// /// Dashboard auth cookie name used when the cookie is not guaranteed to be Secure /// (RequireHttpsCookie=false → ) /// or when an explicit MxGateway:Dashboard:CookieName override is absent but the /// secure default cannot be applied. This plain name carries no browser-enforced guarantees. /// public const string CookieName = "MxGatewayDashboard"; /// /// Dashboard auth cookie name applied when the cookie is guaranteed Secure /// (RequireHttpsCookie=true → ) /// and no explicit MxGateway:Dashboard:CookieName override is set. The __Host- /// prefix instructs browsers to enforce Secure, no Domain, and Path=/; those /// guarantees only hold for a Secure cookie, so this name must never be applied unless /// is in /// effect — a __Host- cookie without Secure is silently dropped by browsers. /// public const string SecureCookieName = "__Host-MxGatewayDashboard"; }