Add tlsCertificateFilePath/tlsKeyFilePath config (#392)

Fixes #374
This commit is contained in:
Kevin Lu
2023-04-17 20:36:02 -07:00
committed by GitHub
parent 86c95f883e
commit 88dd3f4df6
3 changed files with 65 additions and 1 deletions

View File

@@ -2,7 +2,7 @@ name: CI PRs
on:
pull_request:
branches: [ main ]
branches: [ "main", "0.2.x" ]
paths-ignore:
- '.github/**'
env:

View File

@@ -260,6 +260,16 @@ public class PulsarProperties {
*/
private String tlsTrustCertsFilePath;
/**
* Path for the TLS certificate file.
*/
private String tlsCertificateFilePath;
/**
* Path for the TLS private key file.
*/
private String tlsKeyFilePath;
/**
* Whether the client accepts untrusted TLS certificates from the broker.
*/
@@ -523,6 +533,22 @@ public class PulsarProperties {
this.tlsTrustCertsFilePath = tlsTrustCertsFilePath;
}
public String getTlsCertificateFilePath() {
return this.tlsCertificateFilePath;
}
public void setTlsCertificateFilePath(String tlsCertificateFilePath) {
this.tlsCertificateFilePath = tlsCertificateFilePath;
}
public String getTlsKeyFilePath() {
return this.tlsKeyFilePath;
}
public void setTlsKeyFilePath(String tlsKeyFilePath) {
this.tlsKeyFilePath = tlsKeyFilePath;
}
public Boolean getTlsAllowInsecureConnection() {
return this.tlsAllowInsecureConnection;
}
@@ -771,6 +797,8 @@ public class PulsarProperties {
map.from(this::getUseTls).to(properties.in("useTls"));
map.from(this::getTlsHostnameVerificationEnable).to(properties.in("tlsHostnameVerificationEnable"));
map.from(this::getTlsTrustCertsFilePath).to(properties.in("tlsTrustCertsFilePath"));
map.from(this::getTlsCertificateFilePath).to(properties.in("tlsCertificateFilePath"));
map.from(this::getTlsKeyFilePath).to(properties.in("tlsKeyFilePath"));
map.from(this::getTlsAllowInsecureConnection).to(properties.in("tlsAllowInsecureConnection"));
map.from(this::getUseKeyStoreTls).to(properties.in("useKeyStoreTls"));
map.from(this::getSslProvider).to(properties.in("sslProvider"));
@@ -965,6 +993,16 @@ public class PulsarProperties {
*/
private String tlsTrustCertsFilePath;
/**
* Path for the TLS certificate file.
*/
private String tlsCertificateFilePath;
/**
* Path for the TLS private key file.
*/
private String tlsKeyFilePath;
/**
* Whether the client accepts untrusted TLS certificates from the broker.
*/
@@ -1075,6 +1113,22 @@ public class PulsarProperties {
this.tlsTrustCertsFilePath = tlsTrustCertsFilePath;
}
public String getTlsCertificateFilePath() {
return this.tlsCertificateFilePath;
}
public void setTlsCertificateFilePath(String tlsCertificateFilePath) {
this.tlsCertificateFilePath = tlsCertificateFilePath;
}
public String getTlsKeyFilePath() {
return this.tlsKeyFilePath;
}
public void setTlsKeyFilePath(String tlsKeyFilePath) {
this.tlsKeyFilePath = tlsKeyFilePath;
}
public Boolean isTlsAllowInsecureConnection() {
return this.tlsAllowInsecureConnection;
}
@@ -1193,6 +1247,8 @@ public class PulsarProperties {
map.from(this::getAuthentication).as(AuthParameterUtils::maybeConvertToEncodedParamString)
.to(properties.in("authParams"));
map.from(this::getTlsTrustCertsFilePath).to(properties.in("tlsTrustCertsFilePath"));
map.from(this::getTlsCertificateFilePath).to(properties.in("tlsCertificateFilePath"));
map.from(this::getTlsKeyFilePath).to(properties.in("tlsKeyFilePath"));
map.from(this::isTlsAllowInsecureConnection).to(properties.in("tlsAllowInsecureConnection"));
map.from(this::isTlsHostnameVerificationEnable).to(properties.in("tlsHostnameVerificationEnable"));
map.from(this::isUseKeyStoreTls).to(properties.in("useKeyStoreTls"));

View File

@@ -95,6 +95,8 @@ public class PulsarPropertiesTests {
props.put("spring.pulsar.client.use-tls", "true");
props.put("spring.pulsar.client.tls-hostname-verification-enable", "true");
props.put("spring.pulsar.client.tls-trust-certs-file-path", "my-trust-certs-file-path");
props.put("spring.pulsar.client.tls-certificate-file-path", "my-certificate-file-path");
props.put("spring.pulsar.client.tls-key-file-path", "my-key-file-path");
props.put("spring.pulsar.client.tls-allow-insecure-connection", "true");
props.put("spring.pulsar.client.use-key-store-tls", "true");
props.put("spring.pulsar.client.ssl-provider", "my-ssl-provider");
@@ -137,6 +139,8 @@ public class PulsarPropertiesTests {
.containsEntry("useTcpNoDelay", false).containsEntry("useTls", true)
.containsEntry("tlsHostnameVerificationEnable", true)
.containsEntry("tlsTrustCertsFilePath", "my-trust-certs-file-path")
.containsEntry("tlsCertificateFilePath", "my-certificate-file-path")
.containsEntry("tlsKeyFilePath", "my-key-file-path")
.containsEntry("tlsAllowInsecureConnection", true).containsEntry("useKeyStoreTls", true)
.containsEntry("sslProvider", "my-ssl-provider")
.containsEntry("tlsTrustStoreType", "my-trust-store-type")
@@ -226,6 +230,8 @@ public class PulsarPropertiesTests {
props.put("spring.pulsar.administration.auto-cert-refresh-time", "15s");
props.put("spring.pulsar.administration.tls-hostname-verification-enable", "true");
props.put("spring.pulsar.administration.tls-trust-certs-file-path", "my-trust-certs-file-path");
props.put("spring.pulsar.administration.tls-certificate-file-path", "my-certificate-file-path");
props.put("spring.pulsar.administration.tls-key-file-path", "my-key-file-path");
props.put("spring.pulsar.administration.tls-allow-insecure-connection", "true");
props.put("spring.pulsar.administration.use-key-store-tls", "true");
props.put("spring.pulsar.administration.ssl-provider", "my-ssl-provider");
@@ -249,6 +255,8 @@ public class PulsarPropertiesTests {
.containsEntry("requestTimeoutMs", 14_000).containsEntry("autoCertRefreshSeconds", 15)
.containsEntry("tlsHostnameVerificationEnable", true)
.containsEntry("tlsTrustCertsFilePath", "my-trust-certs-file-path")
.containsEntry("tlsCertificateFilePath", "my-certificate-file-path")
.containsEntry("tlsKeyFilePath", "my-key-file-path")
.containsEntry("tlsAllowInsecureConnection", true).containsEntry("useKeyStoreTls", true)
.containsEntry("sslProvider", "my-ssl-provider")
.containsEntry("tlsTrustStoreType", "my-trust-store-type")