mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Overriding the default ssl certificate via file. #313
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @adusak on GitHub (Nov 6, 2020).
Hey, I have a question regarding the configuration of SSL certificate.
As I understand WireMock used to ship with a custom self-signed which was used when setting up https endpoints.
Sice .NET Core 3 it relies on the dev certificate created by the SDK toolkit.
My question is whether it is possible to override this configuration a use a custom ssl certificate from a file.
My use-case is for example is CI. We run some builds on build agents but not all of them are correctly configured with the dev certificate. So some of the unit tests can fail. I would like to be able to remove the dependency on the environment and be able to configure the SSL certificate from a file - since importing to cert store is out of the question on the build agent.
Is there some settings I am overlooking?
Thank you for your time and an awesome nuget!
@StefH commented on GitHub (Nov 7, 2020):
Hello @adusak, are you running WireMock.Net as C# in your unit-tests? Or do you use a separate Docker instance?
@adusak commented on GitHub (Nov 7, 2020):
Hey, I am using it in C# unit tests.
@StefH commented on GitHub (Nov 7, 2020):
Hi @adusak,
I've created a fix based on this article: https://devblogs.microsoft.com/aspnet/configuring-https-in-asp-net-core-across-different-platforms/
I've added a new property
CertificateSettingson theWireMockServerSettingsclass.@StefH commented on GitHub (Nov 7, 2020):
Sorry, please use MyGet version
WireMock.Net.1.3.5-ci-13960.nupkg.See : https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions
@adusak commented on GitHub (Nov 7, 2020):
Wow, nice! It works like a charm 🙂 I was actually thinking of doing a PR with something along those lines if the config was missing.
Thanks!
@StefH commented on GitHub (Nov 7, 2020):
If you install version
WireMock.Net.1.3.5-ci-13964.nupkg: this one has an extra setting "X509StoreThumbprintOrSubjectName" which you can set if you like.(https://github.com/WireMock-Net/WireMock.Net/blob/certificate/src/WireMock.Net/Settings/IWireMockCertificateSettings.cs#L25)
(needed in case you have multiple
localhostcertificates defined in your store)@StefH commented on GitHub (Nov 8, 2020):
See also https://github.com/WireMock-Net/WireMock.Net/wiki/Settings#certificatesettings
@StefH commented on GitHub (Nov 10, 2020):
@adusak Can you do a last final test ?
@adusak commented on GitHub (Nov 10, 2020):
Tested with the
WireMock.Net.1.3.5-ci-13964.nupkgversion and it still works great!@StefH commented on GitHub (Nov 10, 2020):
Code is merged to master. A new official NuGet will be ready soon.