risdenk commented on a change in pull request #54: [WIP] KNOX-1756 - Knox 
Gateway TLS Keystore and Alias Should be Configurable
URL: https://github.com/apache/knox/pull/54#discussion_r258101889
 
 

 ##########
 File path: 
gateway-spi/src/main/java/org/apache/knox/gateway/services/security/impl/CMFKeystoreService.java
 ##########
 @@ -41,26 +41,24 @@
   private static final String TEST_CERT_DN = 
"CN=hadoop,OU=Test,O=Hadoop,L=Test,ST=Test,C=US";
   private static final String CREDENTIALS_SUFFIX = "-credentials.jceks";
 
-  private String serviceName;
+  private final String serviceName;
+  private final File keyStoreDir;
 
   public CMFKeystoreService(String keystoreDir, String serviceName)
       throws ServiceLifecycleException {
     this.serviceName = serviceName;
-    this.keyStoreDir = keystoreDir + File.separator;
-    File ksd = new File(this.keyStoreDir);
-    if (!ksd.exists() && !ksd.mkdirs()) {
+    this.keyStoreDir = new File(keystoreDir);
+    if (!this.keyStoreDir.exists() && !this.keyStoreDir.mkdirs()) {
       throw new ServiceLifecycleException("Cannot create the keystore 
directory");
     }
   }
 
   public void createKeystore() throws KeystoreServiceException {
-    String filename = keyStoreDir + serviceName + ".jks";
-    createKeystore(filename, "JKS");
+    createKeystore(new File(keyStoreDir, serviceName + ".jks"), "JKS", 
getMasterSecret());
 
 Review comment:
   you have keystore type defined elsewhere. Use it here instead of "JKS"?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to