knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [knox] branch master updated: KNOX-1789 - Fix RemoteAliasService fallback after KNOX-1756
Date Sat, 02 Mar 2019 18:00:06 GMT
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 465ee34  KNOX-1789 - Fix RemoteAliasService fallback after KNOX-1756
465ee34 is described below

commit 465ee3476aa3d31caafe63d7d6597ad32f1d732c
Author: Kevin Risden <krisden@apache.org>
AuthorDate: Sat Mar 2 11:13:45 2019 -0600

    KNOX-1789 - Fix RemoteAliasService fallback after KNOX-1756
    
    Signed-off-by: Kevin Risden <krisden@apache.org>
---
 .../knox/gateway/services/CLIGatewayServices.java  |  1 +
 .../services/security/impl/RemoteAliasService.java | 46 +++++++++++++++++++---
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
b/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
index fea6ddc..11e1f47 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
@@ -52,6 +52,7 @@ public class CLIGatewayServices implements GatewayServices {
 
     DefaultAliasService defaultAlias = new DefaultAliasService();
     defaultAlias.setKeystoreService(ks);
+    defaultAlias.setMasterService(ms);
     defaultAlias.init(config, options);
 
     /*
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/RemoteAliasService.java
b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/RemoteAliasService.java
index 0509d45..13f7332 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/RemoteAliasService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/RemoteAliasService.java
@@ -56,7 +56,6 @@ public class RemoteAliasService implements AliasService {
   private final MasterService ms;
 
   private AliasService remoteAliasServiceImpl;
-  private GatewayConfig config;
 
   public RemoteAliasService(AliasService localAliasService, MasterService ms) {
     this.localAliasService = localAliasService;
@@ -179,22 +178,58 @@ public class RemoteAliasService implements AliasService {
 
   @Override
   public char[] getGatewayIdentityPassphrase() throws AliasServiceException {
-    return getPasswordFromAliasForGateway(config.getIdentityKeyPassphraseAlias());
+    char[] password = null;
+    if(remoteAliasServiceImpl != null) {
+      password = remoteAliasServiceImpl.getGatewayIdentityPassphrase();
+    }
+
+    if(password == null) {
+      password = localAliasService.getGatewayIdentityPassphrase();
+    }
+
+    return password;
   }
 
   @Override
   public char[] getGatewayIdentityKeystorePassword() throws AliasServiceException {
-    return getPasswordFromAliasForGateway(config.getIdentityKeystorePasswordAlias());
+    char[] password = null;
+    if(remoteAliasServiceImpl != null) {
+      password = remoteAliasServiceImpl.getGatewayIdentityKeystorePassword();
+    }
+
+    if(password == null) {
+      password = localAliasService.getGatewayIdentityKeystorePassword();
+    }
+
+    return password;
   }
 
   @Override
   public char[] getSigningKeyPassphrase() throws AliasServiceException {
-    return getPasswordFromAliasForGateway(config.getSigningKeyPassphraseAlias());
+    char[] password = null;
+    if(remoteAliasServiceImpl != null) {
+      password = remoteAliasServiceImpl.getSigningKeyPassphrase();
+    }
+
+    if(password == null) {
+      password = localAliasService.getSigningKeyPassphrase();
+    }
+
+    return password;
   }
 
   @Override
   public char[] getSigningKeystorePassword() throws AliasServiceException {
-    return getPasswordFromAliasForGateway(config.getIdentityKeystorePasswordAlias());
+    char[] password = null;
+    if(remoteAliasServiceImpl != null) {
+      password = remoteAliasServiceImpl.getSigningKeystorePassword();
+    }
+
+    if(password == null) {
+      password = localAliasService.getSigningKeystorePassword();
+    }
+
+    return password;
   }
 
   @Override
@@ -213,7 +248,6 @@ public class RemoteAliasService implements AliasService {
   @Override
   public void init(final GatewayConfig config, final Map<String, String> options)
       throws ServiceLifecycleException {
-    this.config = config;
     Map<String, String> remoteAliasServiceConfigs = config.getRemoteAliasServiceConfiguration();
 
     if(config.isRemoteAliasServiceEnabled() && remoteAliasServiceConfigs != null)
{


Mime
View raw message