From 532e9933f3e9463933346fa1312e503ce44474dc Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 29 May 2026 07:44:33 -0400 Subject: [PATCH] feat(security): extend OtOpcUaCookieOptions with RequireHttpsCookie + ZB.MOM.WW cookie name default --- .../CookieOptions.cs | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Security/CookieOptions.cs b/src/Server/ZB.MOM.WW.OtOpcUa.Security/CookieOptions.cs index ad581077..ee39de9b 100644 --- a/src/Server/ZB.MOM.WW.OtOpcUa.Security/CookieOptions.cs +++ b/src/Server/ZB.MOM.WW.OtOpcUa.Security/CookieOptions.cs @@ -1,12 +1,30 @@ namespace ZB.MOM.WW.OtOpcUa.Security; +/// +/// Auth-cookie configuration bound from Security:Cookie. Consumed by a +/// Configure<IOptions<OtOpcUaCookieOptions>, ILoggerFactory> step inside +/// AddOtOpcUaAuth that copies the values onto CookieAuthenticationOptions. +/// public sealed class OtOpcUaCookieOptions { + /// Configuration section name (Security:Cookie). public const string SectionName = "Security:Cookie"; - /// Gets or sets the cookie name. - public string Name { get; set; } = "OtOpcUa.Auth"; + /// + /// Auth cookie name. Default uses the ZB.MOM.WW convention; mirrors ScadaBridge's + /// ZB.MOM.WW.ScadaBridge.Auth. Changing this invalidates existing sessions on next + /// deploy. + /// + public string Name { get; set; } = "ZB.MOM.WW.OtOpcUa.Auth"; - /// Idle sliding window, in minutes (default 30). + /// Idle sliding-window length in minutes (default 30). public int ExpiryMinutes { get; set; } = 30; + + /// + /// Require HTTPS for the auth cookie. Default true: cookie is marked + /// SecurePolicy = Always. Set to false ONLY for local dev stacks running + /// plain HTTP — emits a startup Warning when disabled so the misconfiguration is + /// audible. + /// + public bool RequireHttpsCookie { get; set; } = true; }