From a0b21ca225b3aa550c39de49943cc5ca0a94362f Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 16 Jun 2026 09:23:13 -0400 Subject: [PATCH] refactor(dashboard): consistent effective-user in disable-login warning; doc the config read --- .../Dashboard/DashboardServiceCollectionExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/DashboardServiceCollectionExtensions.cs b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/DashboardServiceCollectionExtensions.cs index 720f0d8..133b878 100644 --- a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/DashboardServiceCollectionExtensions.cs +++ b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/DashboardServiceCollectionExtensions.cs @@ -22,7 +22,8 @@ public static class DashboardServiceCollectionExtensions /// Service collection to register services. /// /// Application configuration, used to bind the shared LDAP provider's options - /// from the MxGateway:Ldap section. + /// from the MxGateway:Ldap section. Also read to select the dashboard + /// authentication scheme via the MxGateway:Dashboard:DisableLogin dev flag. /// public static IServiceCollection AddGatewayDashboard( this IServiceCollection services, @@ -80,7 +81,9 @@ public static class DashboardServiceCollectionExtensions "DASHBOARD LOGIN DISABLED (MxGateway:Dashboard:DisableLogin=true) — every request is " + "authenticated as '{User}' with full permissions ({Roles}). Dev/test only; never " + "enable in production.", - gatewayOptions.Dashboard.AutoLoginUser ?? DashboardAutoLoginAuthenticationHandler.DefaultUser, + string.IsNullOrWhiteSpace(gatewayOptions.Dashboard.AutoLoginUser) + ? DashboardAutoLoginAuthenticationHandler.DefaultUser + : gatewayOptions.Dashboard.AutoLoginUser!.Trim(), $"{DashboardRoles.Admin}, {DashboardRoles.Viewer}")); } else