Skip to content

Commit ad51ce6

Browse files
Merge pull request kurrent-io#289 from EventStore/add-certificates-in-http-fallback-handler
DEV-92 - Add certificate in HTTP fallback handler
2 parents 5bd189a + 6bb1999 commit ad51ce6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/EventStore.Client/HttpFallback.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ internal HttpFallback (EventStoreClientSettings settings) {
1717
_defaultCredentials = settings.DefaultCredentials;
1818

1919
var handler = new HttpClientHandler();
20-
if (!settings.ConnectivitySettings.Insecure && !settings.ConnectivitySettings.TlsVerifyCert) {
20+
if (!settings.ConnectivitySettings.Insecure) {
2121
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
22-
handler.ServerCertificateCustomValidationCallback = (_, _, _, _) => true;
22+
23+
if (settings.ConnectivitySettings.TlsCaFile != null)
24+
handler.ClientCertificates.Add(settings.ConnectivitySettings.TlsCaFile);
25+
26+
if (!settings.ConnectivitySettings.TlsVerifyCert)
27+
handler.ServerCertificateCustomValidationCallback = (_, _, _, _) => true;
2328
}
24-
29+
2530
_httpClient = new HttpClient(handler);
2631
if (settings.DefaultDeadline.HasValue) {
2732
_httpClient.Timeout = settings.DefaultDeadline.Value;

0 commit comments

Comments
 (0)