namespace ZB.MOM.WW.OtOpcUa.Server.Security;
///
/// Validates a (username, password) pair and returns the resolved OPC UA roles for the user.
/// The Server's SessionManager_ImpersonateUser hook delegates here so unit tests can
/// swap in a fake authenticator without a live LDAP.
///
public interface IUserAuthenticator
{
Task AuthenticateAsync(string username, string password, CancellationToken ct = default);
}
public sealed record UserAuthResult(bool Success, string? DisplayName, IReadOnlyList Roles, string? Error);
///
/// Always-reject authenticator used when no security config is provided. Lets the server
/// start (with only an anonymous endpoint) without throwing on UserName token attempts.
///
public sealed class DenyAllUserAuthenticator : IUserAuthenticator
{
public Task AuthenticateAsync(string _, string __, CancellationToken ___)
=> Task.FromResult(new UserAuthResult(false, null, [], "UserName token not supported"));
}