mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 08:48:28 +02:00
Make X509CertificatePassword optional (#732)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
@@ -57,7 +57,12 @@ namespace WireMock.HttpsCertificate
|
|||||||
return new X509Certificate2(filePath, password);
|
return new X509Certificate2(filePath, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException("X509StoreName and X509StoreLocation OR X509CertificateFilePath and X509CertificatePassword are mandatory.");
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
|
{
|
||||||
|
return new X509Certificate2(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("X509StoreName and X509StoreLocation OR X509CertificateFilePath are mandatory. Note that X509CertificatePassword is optional.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace WireMock.Owin
|
|||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.CustomCertificateDefined"/>
|
/// <inheritdoc cref="IWireMockMiddlewareOptions.CustomCertificateDefined"/>
|
||||||
public bool CustomCertificateDefined =>
|
public bool CustomCertificateDefined =>
|
||||||
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
||||||
!string.IsNullOrEmpty(X509CertificateFilePath) && !string.IsNullOrEmpty(X509CertificatePassword);
|
!string.IsNullOrEmpty(X509CertificateFilePath);
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.SaveUnmatchedRequests"/>
|
/// <inheritdoc cref="IWireMockMiddlewareOptions.SaveUnmatchedRequests"/>
|
||||||
public bool? SaveUnmatchedRequests { get; set; }
|
public bool? SaveUnmatchedRequests { get; set; }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace WireMock.Settings
|
namespace WireMock.Settings
|
||||||
{
|
{
|
||||||
@@ -31,6 +31,6 @@ namespace WireMock.Settings
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public bool IsDefined =>
|
public bool IsDefined =>
|
||||||
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
||||||
!string.IsNullOrEmpty(X509CertificateFilePath) && !string.IsNullOrEmpty(X509CertificatePassword);
|
!string.IsNullOrEmpty(X509CertificateFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user