This is an automated email from the ASF dual-hosted git repository.
msingh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new cec6b21 RATIS-1331. Make GrpcTLS config truststore param list. (#436)
cec6b21 is described below
commit cec6b2191881c12c21ea93518d1ac18cbe894d9d
Author: Bharat Viswanadham <[email protected]>
AuthorDate: Tue Mar 9 09:55:09 2021 +0530
RATIS-1331. Make GrpcTLS config truststore param list. (#436)
---
.../main/java/org/apache/ratis/grpc/GrpcTlsConfig.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcTlsConfig.java
b/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcTlsConfig.java
index f9e2455..3a17145 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcTlsConfig.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcTlsConfig.java
@@ -20,6 +20,8 @@ package org.apache.ratis.grpc;
import java.io.File;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
+import java.util.Collections;
+import java.util.List;
/**
* Ratis GRPC TLS configurations.
@@ -34,7 +36,7 @@ public class GrpcTlsConfig {
private File certChainFile;
// ca certificate
- private X509Certificate trustStore;
+ private List<X509Certificate> trustStore;
private File trustStoreFile;
// mutual TLS enabled
@@ -62,7 +64,7 @@ public class GrpcTlsConfig {
return certChainFile;
}
- public X509Certificate getTrustStore() {
+ public List<X509Certificate> getTrustStore() {
return trustStore;
}
@@ -75,7 +77,7 @@ public class GrpcTlsConfig {
}
public GrpcTlsConfig(PrivateKey privateKey, X509Certificate certChain,
- X509Certificate trustStore, boolean mTlsEnabled) {
+ List<X509Certificate> trustStore, boolean mTlsEnabled) {
this.privateKey = privateKey;
this.certChain = certChain;
this.trustStore = trustStore;
@@ -83,6 +85,15 @@ public class GrpcTlsConfig {
this.fileBasedConfig = false;
}
+ public GrpcTlsConfig(PrivateKey privateKey, X509Certificate certChain,
+ X509Certificate trustStore, boolean mTlsEnabled) {
+ this.privateKey = privateKey;
+ this.certChain = certChain;
+ this.trustStore = Collections.singletonList(trustStore);
+ this.mTlsEnabled = mTlsEnabled;
+ this.fileBasedConfig = false;
+ }
+
public GrpcTlsConfig(File privateKeyFile, File certChainFile,
File trustStoreFile, boolean mTlsEnabled) {
this.privateKeyFile = privateKeyFile;