mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 08:18:26 +02:00
Add option to provide X509Certificate (#1303)
* Add option to provide X509CertificateRawData * X509Certificate * remove X509CertificateRawData
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace WireMock.Settings;
|
||||
@@ -9,36 +10,44 @@ namespace WireMock.Settings;
|
||||
///
|
||||
/// X509StoreName and X509StoreLocation should be defined
|
||||
/// OR
|
||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
||||
/// X509CertificateFilePath should be defined
|
||||
/// OR
|
||||
/// X509Certificate should be defined
|
||||
/// </summary>
|
||||
public class WireMockCertificateSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// X509 StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher)
|
||||
/// X.509 certificate StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher)
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? X509StoreName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X509 StoreLocation (CurrentUser or LocalMachine)
|
||||
/// X.509 certificate StoreLocation (CurrentUser or LocalMachine)
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? X509StoreLocation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X509 Thumbprint or SubjectName (if not defined, the 'host' is used)
|
||||
/// X.509 certificate Thumbprint or SubjectName (if not defined, the 'host' is used)
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? X509StoreThumbprintOrSubjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X509Certificate FilePath
|
||||
/// X.509 certificate FilePath
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? X509CertificateFilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X509Certificate Password
|
||||
/// A X.509 certificate instance.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public X509Certificate2? X509Certificate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// X.509 certificate Password
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? X509CertificatePassword { get; set; }
|
||||
@@ -46,10 +55,13 @@ public class WireMockCertificateSettings
|
||||
/// <summary>
|
||||
/// X509StoreName and X509StoreLocation should be defined
|
||||
/// OR
|
||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
||||
/// X509CertificateFilePath should be defined
|
||||
/// OR
|
||||
/// X509Certificate should be defined
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public bool IsDefined =>
|
||||
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
||||
!string.IsNullOrEmpty(X509CertificateFilePath);
|
||||
!string.IsNullOrEmpty(X509CertificateFilePath) ||
|
||||
X509Certificate != null;
|
||||
}
|
||||
@@ -235,7 +235,9 @@ public class WireMockServerSettings
|
||||
///
|
||||
/// X509StoreName and X509StoreLocation should be defined
|
||||
/// OR
|
||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
||||
/// X509CertificateFilePath should be defined
|
||||
/// OR
|
||||
/// X509Certificate should be defined
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public WireMockCertificateSettings? CertificateSettings { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user