risdenk commented on a change in pull request #61: KNOX-1793 - DefaultKeystoreService should not validate the signing key on initialization URL: https://github.com/apache/knox/pull/61#discussion_r260760405
########## File path: gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenAuthorityService.java ########## @@ -205,26 +212,64 @@ public void init(GatewayConfig config, Map<String, String> options) if (as == null || ks == null) { throw new ServiceLifecycleException("Alias or Keystore service is not set"); } - signingKeyAlias = config.getSigningKeyAlias(); + this.config = config; + } + + @Override + public void start() throws ServiceLifecycleException { + // Ensure that the default signing keystore is available + KeyStore keystore; + try { + keystore = ks.getSigningKeystore(); + if (keystore == null) { + throw new ServiceLifecycleException(RESOURCES.signingKeystoreNotAvailable(config.getSigningKeystorePath())); + } + } catch (KeystoreServiceException e) { + throw new ServiceLifecycleException(RESOURCES.signingKeystoreNotAvailable(config.getSigningKeystorePath()), e); + } - RSAPrivateKey key; + // Ensure that the password for the signing key is available char[] passphrase; try { passphrase = as.getSigningKeyPassphrase(); - if (passphrase != null) { - key = (RSAPrivateKey) ks.getSigningKey(getSigningKeyAlias(signingKeyAlias), - passphrase); - if (key == null) { - throw new ServiceLifecycleException("Provisioned passphrase cannot be used to acquire signing key."); - } + if (passphrase == null) { + throw new ServiceLifecycleException(RESOURCES.signingKeyPassphraseNotAvailable(config.getSigningKeyAlias())); Review comment: should be `config.getSigningKeyPassphraseAlias()` ---------------------------------------------------------------- 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