diff --git a/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs b/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs index 1390cf6ca..b6d6ee60a 100644 --- a/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs +++ b/src/EventStore.Client/EventStoreClientSettings.ConnectionString.cs @@ -41,8 +41,8 @@ private static class ConnectionStringParser { private const string ThrowOnAppendFailure = nameof(ThrowOnAppendFailure); private const string KeepAliveInterval = nameof(KeepAliveInterval); private const string KeepAliveTimeout = nameof(KeepAliveTimeout); - private const string CertPath = nameof(CertPath); - private const string CertKeyPath = nameof(CertKeyPath); + private const string UserCertFile = nameof(UserCertFile); + private const string UserKeyFile = nameof(UserKeyFile); private const string UriSchemeDiscover = "esdb+discover"; @@ -64,8 +64,8 @@ private static class ConnectionStringParser { { ThrowOnAppendFailure, typeof(bool) }, { KeepAliveInterval, typeof(int) }, { KeepAliveTimeout, typeof(int) }, - { CertPath, typeof(string)}, - { CertKeyPath, typeof(string)}, + { UserCertFile, typeof(string)}, + { UserKeyFile, typeof(string)}, }; public static EventStoreClientSettings Parse(string connectionString) { @@ -288,23 +288,23 @@ HttpMessageHandler CreateDefaultHandler() { } static void ConfigureClientCertificate(EventStoreClientSettings settings, IReadOnlyDictionary options) { - var certPemFilePath = GetOptionValueAsString(CertPath); - var keyPemFilePath = GetOptionValueAsString(CertKeyPath); + var certPemFilePath = GetOptionValueAsString(UserCertFile); + var keyPemFilePath = GetOptionValueAsString(UserKeyFile); if (string.IsNullOrEmpty(certPemFilePath) && string.IsNullOrEmpty(keyPemFilePath)) return; if (string.IsNullOrEmpty(certPemFilePath) || string.IsNullOrEmpty(keyPemFilePath)) - throw new InvalidClientCertificateException("Invalid client certificate settings. Both CertPath and CertKeyPath must be set."); + throw new InvalidClientCertificateException("Invalid client certificate settings. Both UserCertFile and UserKeyFile must be set."); if (!File.Exists(certPemFilePath)) throw new InvalidClientCertificateException( - $"Invalid client certificate settings. The specified CertPath does not exist: {certPemFilePath}" + $"Invalid client certificate settings. The specified UserCertFile does not exist: {certPemFilePath}" ); if (!File.Exists(keyPemFilePath)) throw new InvalidClientCertificateException( - $"Invalid client certificate settings. The specified CertKeyPath does not exist: {keyPemFilePath}" + $"Invalid client certificate settings. The specified UserKeyFile does not exist: {keyPemFilePath}" ); try { diff --git a/test/EventStore.Client.Plugins.Tests/ClientCertificate.cs b/test/EventStore.Client.Plugins.Tests/ClientCertificate.cs index 5c9678aa0..b680dbb56 100644 --- a/test/EventStore.Client.Plugins.Tests/ClientCertificate.cs +++ b/test/EventStore.Client.Plugins.Tests/ClientCertificate.cs @@ -42,24 +42,23 @@ async Task append_with_different_tls_cert_path(string certificateFilePath) { [Theory] [MemberData(nameof(AdminClientCertPaths))] - async Task append_with_admin_client_certificate(string certPath, string certKeyPath) { - Fixture.Log.Information("CertPath: {certPath}, CertKeyPath: {certKeyPath}", certPath, certKeyPath); - await AppendWithCertificate($"esdb://localhost:2113/?tls=true&tlsVerifyCert=true&certPath={certPath}&certKeyPath={certKeyPath}"); + async Task append_with_admin_client_certificate(string userCertFile, string userKeyFile) { + await AppendWithCertificate($"esdb://localhost:2113/?tls=true&tlsVerifyCert=true&userCertFile={userCertFile}&userKeyFile={userKeyFile}"); } [Theory] [MemberData(nameof(BadClientCertPaths))] - async Task append_with_bad_client_certificate(string certPath, string certKeyPath) { + async Task append_with_bad_client_certificate(string userCertFile, string userKeyFile) { await AssertAppendFailsWithCertificate( - $"esdb://localhost:2113/?tls=true&tlsVerifyCert=true&certPath={certPath}&certKeyPath={certKeyPath}", + $"esdb://localhost:2113/?tls=true&tlsVerifyCert=true&userCertFile={userCertFile}&userKeyFile={userKeyFile}", typeof(NotAuthenticatedException) ); } [Theory] [MemberData(nameof(BadClientCertPaths))] - async Task user_credentials_takes_precedence_over_client_certificates(string certPath, string certKeyPath) { - await AppendWithCertificate($"esdb://admin:changeit@localhost:2113/?tls=true&tlsVerifyCert=true&certPath={certPath}&certKeyPath={certKeyPath}"); + async Task user_credentials_takes_precedence_over_client_certificates(string userCertFile, string userKeyFile) { + await AppendWithCertificate($"esdb://admin:changeit@localhost:2113/?tls=true&tlsVerifyCert=true&userCertFile={userCertFile}&userKeyFile={userKeyFile}"); } async Task AppendWithCertificate(string connectionString) { diff --git a/test/EventStore.Client.Tests/ConnectionStringTests.cs b/test/EventStore.Client.Tests/ConnectionStringTests.cs index d1bd4c5f5..e258c682d 100644 --- a/test/EventStore.Client.Tests/ConnectionStringTests.cs +++ b/test/EventStore.Client.Tests/ConnectionStringTests.cs @@ -172,10 +172,10 @@ public void connection_string_with_invalid_tls_certificate_should_throw(string c [Theory] [MemberData(nameof(InvalidClientCertificates))] - public void connection_string_with_invalid_client_certificate_should_throw(string certPath, string certKeyPath) { + public void connection_string_with_invalid_client_certificate_should_throw(string userCertFile, string userKeyFile) { Assert.Throws( () => EventStoreClientSettings.Create( - $"esdb://admin:changeit@localhost:2113/?tls=true&tlsVerifyCert=true&certPath={certPath}&certKeyPath={certKeyPath}" + $"esdb://admin:changeit@localhost:2113/?tls=true&tlsVerifyCert=true&userCertFile={userCertFile}&userKeyFile={userKeyFile}" ) ); }