mirror of
https://github.com/ditkrg/asp.netcore-authentication.git
synced 2026-01-22 23:07:01 +00:00
Do not throw on postConfigure
This commit is contained in:
parent
75f0d765d1
commit
9c4a28ce59
@ -15,6 +15,9 @@ internal sealed class CertificateSignatureValidator : ISignatureValidator
|
|||||||
{
|
{
|
||||||
if (_rsa is not null) return;
|
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));
|
var certificate = new X509Certificate2(Encoding.ASCII.GetBytes(options.Certificate));
|
||||||
_rsa = certificate.GetRSAPublicKey() ?? throw new InvalidOperationException("Could not get RSA public key from certificate");
|
_rsa = certificate.GetRSAPublicKey() ?? throw new InvalidOperationException("Could not get RSA public key from certificate");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,6 @@ public sealed class PostConfigureOptions : IPostConfigureOptions<GatewayAuthOpti
|
|||||||
|
|
||||||
public void PostConfigure(string? name, GatewayAuthOptions options)
|
public void PostConfigure(string? name, GatewayAuthOptions options)
|
||||||
{
|
{
|
||||||
if (options.Certificate == null)
|
|
||||||
throw new InvalidOperationException("Certificate is null");
|
|
||||||
|
|
||||||
_signatureValidator.Initialize(options);
|
_signatureValidator.Initialize(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user