@@ -80,6 +80,11 @@ public void testConnection()
8080 private final Path trustStorePath ;
8181 private final Path certificatePath ;
8282 private final Path privateKeyPath ;
83+ private final char [] privateKeyPassword ;
84+
85+ private final int connectTimeout ;
86+ private final int socketTimeout ;
87+ private final int connectionRequestTimeout ;
8388
8489 private final String fttpServerBase ;
8590 private final String fttpBasicAuthUsername ;
@@ -89,24 +94,21 @@ public void testConnection()
8994 private final String fttpStudy ;
9095 private final String fttpTarget ;
9196
92- private final int connectTimeout ;
93- private final int socketTimeout ;
94- private final int connectionRequestTimeout ;
95-
96- private final String proxySchemeHostPort ;
97+ private final String proxyUrl ;
9798 private final String proxyUsername ;
9899 private final String proxyPassword ;
99100
100101 private final boolean hapiClientVerbose ;
101102
102- public FttpClientFactory (Path trustStorePath , Path certificatePath , Path privateKeyPath , int connectTimeout ,
103- int socketTimeout , int connectionRequestTimeout , String fttpBasicAuthUsername , String fttpBasicAuthPassword ,
104- String fttpServerBase , String fttpApiKey , String fttpStudy , String fttpTarget , String proxySchemeHostPort ,
105- String proxyUsername , String proxyPassword , boolean hapiClientVerbose )
103+ public FttpClientFactory (Path trustStorePath , Path certificatePath , Path privateKeyPath , char [] privateKeyPassword ,
104+ int connectTimeout , int socketTimeout , int connectionRequestTimeout , String fttpBasicAuthUsername ,
105+ String fttpBasicAuthPassword , String fttpServerBase , String fttpApiKey , String fttpStudy , String fttpTarget ,
106+ String proxyUrl , String proxyUsername , String proxyPassword , boolean hapiClientVerbose )
106107 {
107108 this .trustStorePath = trustStorePath ;
108109 this .certificatePath = certificatePath ;
109110 this .privateKeyPath = privateKeyPath ;
111+ this .privateKeyPassword = privateKeyPassword ;
110112
111113 this .connectTimeout = connectTimeout ;
112114 this .socketTimeout = socketTimeout ;
@@ -120,7 +122,7 @@ public FttpClientFactory(Path trustStorePath, Path certificatePath, Path private
120122 this .fttpStudy = fttpStudy ;
121123 this .fttpTarget = fttpTarget ;
122124
123- this .proxySchemeHostPort = proxySchemeHostPort ;
125+ this .proxyUrl = proxyUrl ;
124126 this .proxyUsername = proxyUsername ;
125127 this .proxyPassword = proxyPassword ;
126128
@@ -133,8 +135,11 @@ public void onContextRefreshedEvent(ContextRefreshedEvent event)
133135 try
134136 {
135137 logger .info (
136- "Testing connection to fTTP with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, fttpServerBase: {}, fttpApiKey: {}, fttpStudy: {}, fttpTarget: {}}" ,
137- trustStorePath , certificatePath , privateKeyPath , fttpServerBase , fttpApiKey , fttpStudy , fttpTarget );
138+ "Testing connection to fTTP with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
139+ + " basicAuthUsername {}, basicAuthPassword {}, serverBase: {}, apiKey: {}, study: {}, target: {}, proxyUrl {}, proxyUsername, proxyPassword {}}" ,
140+ trustStorePath , certificatePath , privateKeyPath , privateKeyPassword != null ? "***" : "null" ,
141+ fttpBasicAuthUsername , fttpBasicAuthPassword != null ? "***" : "null" , fttpServerBase , fttpApiKey ,
142+ fttpStudy , fttpTarget , proxyUrl , proxyUsername , proxyPassword != null ? "***" : "null" );
138143
139144 getFttpClient ().testConnection ();
140145 }
@@ -166,11 +171,11 @@ protected FttpClient createFttpClient()
166171 char [] keyStorePassword = UUID .randomUUID ().toString ().toCharArray ();
167172
168173 logger .debug ("Creating key-store from {} and {}" , certificatePath .toString (), privateKeyPath .toString ());
169- KeyStore keyStore = readKeyStore (certificatePath , privateKeyPath , keyStorePassword );
174+ KeyStore keyStore = readKeyStore (certificatePath , privateKeyPath , privateKeyPassword , keyStorePassword );
170175
171176 return new FttpClientImpl (trustStore , keyStore , keyStorePassword , connectTimeout , socketTimeout ,
172177 connectionRequestTimeout , fttpBasicAuthUsername , fttpBasicAuthPassword , fttpServerBase , fttpApiKey ,
173- fttpStudy , fttpTarget , proxySchemeHostPort , proxyUsername , proxyPassword , hapiClientVerbose );
178+ fttpStudy , fttpTarget , proxyUrl , proxyUsername , proxyPassword , hapiClientVerbose );
174179 }
175180
176181 private KeyStore readTrustStore (Path trustPath )
@@ -185,11 +190,11 @@ private KeyStore readTrustStore(Path trustPath)
185190 }
186191 }
187192
188- private KeyStore readKeyStore (Path certificatePath , Path keyPath , char [] keyStorePassword )
193+ private KeyStore readKeyStore (Path certificatePath , Path keyPath , char [] keyPassword , char [] keyStorePassword )
189194 {
190195 try
191196 {
192- PrivateKey privateKey = PemIo .readPrivateKeyFromPem (keyPath );
197+ PrivateKey privateKey = PemIo .readPrivateKeyFromPem (keyPath , keyPassword );
193198 X509Certificate certificate = PemIo .readX509CertificateFromPem (certificatePath );
194199
195200 return CertificateHelper .toJksKeyStore (privateKey , new Certificate [] { certificate },
0 commit comments