using System.Security.Claims;
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
///
/// Result of a dashboard authentication attempt.
///
public sealed record DashboardAuthenticationResult(
///
/// Whether authentication succeeded.
///
bool Succeeded,
///
/// The authenticated principal if successful; otherwise null.
///
ClaimsPrincipal? Principal,
///
/// The failure message if authentication failed; otherwise null.
///
string? FailureMessage)
{
///
/// Creates a successful authentication result.
///
/// Authenticated principal.
public static DashboardAuthenticationResult Success(ClaimsPrincipal principal)
{
return new DashboardAuthenticationResult(true, principal, null);
}
///
/// Creates a failed authentication result.
///
/// Diagnostic message describing the failure.
public static DashboardAuthenticationResult Fail(string failureMessage)
{
return new DashboardAuthenticationResult(false, null, failureMessage);
}
}