Possibility to pass a X509Certificate2 to WithProxy() or specifiy certificate loading options #481

Closed
opened 2025-12-29 08:28:53 +01:00 by adam · 7 comments
Owner

Originally created by @FlorianMeinschad on GitHub (Jan 30, 2023).

Originally assigned to: @StefH on GitHub.

Is your feature request related to a problem? Please describe.
We would like to run our wiremock.net setup in a custom docker container.
If no mapping is found for a request, the request is proxied to our staging server, which needs client certificate authentication.
At the moment the WireMock.NET tries to load the certificate by thumbprint or subject name from StoreLocation.LocalMachine, which does not exists on unix and throws an error.

Describe the solution you'd like
The best possible solution for us would be a third method overload for WithProxy(), which accepts a X509Certificate2 as parameter. Then we would be able to load the certificate from a mapped docker volume.

Describe alternatives you've considered
Alternatively it would also be enough to be able to specify the certificate loading options (like the WireMockCertificateSettings class):

  • X509StoreLocation
  • X509StoreName
  • X509StoreThumbprintOrSubjectName
  • X509CertificateFilePath
  • X509CertificatePassword

Thereby it would also be possible to load a certificate from a mapped docker volume or to specify the unix permitted store "CurrentUser".

Is your feature request supported by WireMock (java version)? Please provide details.
I think it's just an extension of the .NET project itself, no explicit relation to wiremock.

Additional context
image

image

Thanks in advance.

Originally created by @FlorianMeinschad on GitHub (Jan 30, 2023). Originally assigned to: @StefH on GitHub. **Is your feature request related to a problem? Please describe.** We would like to run our wiremock.net setup in a custom docker container. If no mapping is found for a request, the request is proxied to our staging server, which needs client certificate authentication. At the moment the WireMock.NET tries to load the certificate by thumbprint or subject name from StoreLocation.LocalMachine, which does not exists on unix and throws an error. **Describe the solution you'd like** The best possible solution for us would be a third method overload for WithProxy(), which accepts a X509Certificate2 as parameter. Then we would be able to load the certificate from a mapped docker volume. **Describe alternatives you've considered** Alternatively it would also be enough to be able to specify the certificate loading options (like the WireMockCertificateSettings class): * X509StoreLocation * X509StoreName * X509StoreThumbprintOrSubjectName * X509CertificateFilePath * X509CertificatePassword Thereby it would also be possible to load a certificate from a mapped docker volume or to specify the unix permitted store "CurrentUser". **Is your feature request supported by [WireMock (java version)](https://www.wiremock.org)? Please provide details.** I think it's just an extension of the .NET project itself, no explicit relation to wiremock. **Additional context** <img width="949" alt="image" src="https://user-images.githubusercontent.com/115091674/215509186-c4c93e16-5b7e-4677-944b-dbac0338ffae.png"> <img width="820" alt="image" src="https://user-images.githubusercontent.com/115091674/215509279-deccdfcc-9f56-456f-a90b-6cd5aa6f9fbf.png"> Thanks in advance.
adam added the feature label 2025-12-29 08:28:53 +01:00
adam closed this issue 2025-12-29 08:28:53 +01:00
Author
Owner

@StefH commented on GitHub (Jan 31, 2023):

I think creating a third method with WireMockCertificateSettings is the easiest solution.

I think creating a third method with X509Certificate2 is the easiest solution.
I'll take a look.

@StefH commented on GitHub (Jan 31, 2023): ~I think creating a third method with `WireMockCertificateSettings` is the easiest solution.~ I think creating a third method with `X509Certificate2 ` is the easiest solution. I'll take a look.
Author
Owner

@StefH commented on GitHub (Jan 31, 2023):

Can you try preview 1.5.15-ci-17006 ?

https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions

@StefH commented on GitHub (Jan 31, 2023): Can you try preview `1.5.15-ci-17006` ? https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
Author
Owner

@StefH commented on GitHub (Feb 1, 2023):

https://github.com/WireMock-Net/WireMock.Net/pull/880

@StefH commented on GitHub (Feb 1, 2023): https://github.com/WireMock-Net/WireMock.Net/pull/880
Author
Owner

@FlorianMeinschad commented on GitHub (Feb 1, 2023):

Works like a charm =)
Thank you very much, we really appreciate it!

@FlorianMeinschad commented on GitHub (Feb 1, 2023): Works like a charm =) Thank you very much, we really appreciate it!
Author
Owner

@StefH commented on GitHub (Feb 1, 2023):

@FlorianMeinschad
I'll create a new official NuGet today.

@StefH commented on GitHub (Feb 1, 2023): @FlorianMeinschad I'll create a new official NuGet today.
Author
Owner

@FlorianMeinschad commented on GitHub (Feb 6, 2023):

Unfortunately, there is still no official NuGet version 1.16.
May it be possible to create it soon?

That would be great, thank you!

@FlorianMeinschad commented on GitHub (Feb 6, 2023): Unfortunately, there is still no official NuGet version 1.16. May it be possible to create it soon? That would be great, thank you!
Author
Owner

@StefH commented on GitHub (Feb 6, 2023):

@FlorianMeinschad Sorry, I forgot to start the NuGet pipeline. It's running now...

@StefH commented on GitHub (Feb 6, 2023): @FlorianMeinschad Sorry, I forgot to start the NuGet pipeline. It's running now...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#481