using Microsoft.Extensions.Options;
namespace ZB.MOM.WW.OtOpcUa.Security.Jwt;
///
/// Startup validator for (R03:2.4): when a signing key is configured it must
/// be usable, and the host must learn that at start (ValidateOnStart) rather than from an HTTP 500
/// on the first /auth/token. An unconfigured section (no key) is valid — the feature is simply off.
///
public sealed class JwtOptionsValidator : IValidateOptions
{
///
public ValidateOptionsResult Validate(string? name, JwtOptions options)
{
ArgumentNullException.ThrowIfNull(options);
var failure = options.Validate();
return failure is null ? ValidateOptionsResult.Success : ValidateOptionsResult.Fail(failure);
}
}