Do not throw on postConfigure

This commit is contained in:
Shkar T. Noori 2023-03-14 00:37:45 +03:00
parent 75f0d765d1
commit 9c4a28ce59
No known key found for this signature in database
GPG Key ID: E7AD76088FB6FE02
2 changed files with 3 additions and 3 deletions

View File

@ -15,6 +15,9 @@ internal sealed class CertificateSignatureValidator : ISignatureValidator
{
if (_rsa is not null) return;
if (string.IsNullOrWhiteSpace(options.Certificate))
throw new InvalidOperationException("Certificate is null or whitespace");
var certificate = new X509Certificate2(Encoding.ASCII.GetBytes(options.Certificate));
_rsa = certificate.GetRSAPublicKey() ?? throw new InvalidOperationException("Could not get RSA public key from certificate");
}

View File

@ -14,9 +14,6 @@ public sealed class PostConfigureOptions : IPostConfigureOptions<GatewayAuthOpti
public void PostConfigure(string? name, GatewayAuthOptions options)
{
if (options.Certificate == null)
throw new InvalidOperationException("Certificate is null");
_signatureValidator.Initialize(options);
}
}