namespace ZB.MOM.WW.OtOpcUa.Admin.Security;
///
/// LDAP + role-mapping configuration for the Admin UI. Bound from appsettings.json
/// Authentication:Ldap section. Defaults point at the local GLAuth dev instance (see
/// C:\publish\glauth\auth.md).
///
public sealed class LdapOptions
{
public const string SectionName = "Authentication:Ldap";
public bool Enabled { get; set; } = true;
public string Server { get; set; } = "localhost";
public int Port { get; set; } = 3893;
public bool UseTls { get; set; }
/// Dev-only escape hatch — must be false in production.
public bool AllowInsecureLdap { get; set; }
public string SearchBase { get; set; } = "dc=lmxopcua,dc=local";
///
/// Service-account DN used for search-then-bind. When empty, a direct-bind with
/// cn={user},{SearchBase} is attempted.
///
public string ServiceAccountDn { get; set; } = string.Empty;
public string ServiceAccountPassword { get; set; } = string.Empty;
public string DisplayNameAttribute { get; set; } = "cn";
public string GroupAttribute { get; set; } = "memberOf";
///
/// Maps LDAP group name → Admin role. Group match is case-insensitive. A user gets every
/// role whose source group is in their membership list. Example dev mapping:
/// "ReadOnly":"ConfigViewer","ReadWrite":"ConfigEditor","AlarmAck":"FleetAdmin"
///
public Dictionary GroupToRole { get; set; } = new(StringComparer.OrdinalIgnoreCase);
}