qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject [1/2] qpid-broker-j git commit: QPID-7567 : [Broker-J] Delegate consistently to underlying KeyManager
Date Mon, 19 Mar 2018 12:41:42 GMT
Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 3f0f55875 -> ac9069ac8


QPID-7567 : [Broker-J] Delegate consistently to underlying KeyManager


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/ac9069ac
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/ac9069ac
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/ac9069ac

Branch: refs/heads/master
Commit: ac9069ac8cc300ca78e7ef1461de5b2eefb4fe46
Parents: 89c69e7
Author: Keith Wall <kwall@apache.org>
Authored: Sat Mar 17 20:22:48 2018 +0000
Committer: Keith Wall <kwall@apache.org>
Committed: Mon Mar 19 12:41:35 2018 +0000

----------------------------------------------------------------------
 .../security/ssl/QpidServerX509KeyManager.java  | 37 ++++++++------------
 1 file changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/ac9069ac/broker-core/src/main/java/org/apache/qpid/server/transport/network/security/ssl/QpidServerX509KeyManager.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/transport/network/security/ssl/QpidServerX509KeyManager.java
b/broker-core/src/main/java/org/apache/qpid/server/transport/network/security/ssl/QpidServerX509KeyManager.java
index 0abf44b..f16d46a 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/transport/network/security/ssl/QpidServerX509KeyManager.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/transport/network/security/ssl/QpidServerX509KeyManager.java
@@ -33,38 +33,31 @@ import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.X509ExtendedKeyManager;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 public class QpidServerX509KeyManager extends X509ExtendedKeyManager
 {
-    private static final Logger LOGGER = LoggerFactory.getLogger(QpidServerX509KeyManager.class);
-
-    private X509ExtendedKeyManager _delegate;
-    private String _alias;
+    private final X509ExtendedKeyManager _delegate;
+    private final String _alias;
 
     public QpidServerX509KeyManager(String alias, URL keyStoreUrl, String keyStoreType,
                                     String keyStorePassword, String keyManagerFactoryAlgorithmName)
throws GeneralSecurityException, IOException
     {
-        this._alias = alias;
-        KeyStore ks = SSLUtil.getInitializedKeyStore(keyStoreUrl,keyStorePassword,keyStoreType);
+        _alias = alias;
+        KeyStore ks = SSLUtil.getInitializedKeyStore(keyStoreUrl, keyStorePassword, keyStoreType);
         KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerFactoryAlgorithmName);
         kmf.init(ks, keyStorePassword.toCharArray());
-        this._delegate = (X509ExtendedKeyManager)kmf.getKeyManagers()[0];
+        _delegate = (X509ExtendedKeyManager) kmf.getKeyManagers()[0];
     }
 
-
     @Override
     public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
     {
-        return _alias == null ? _delegate.chooseClientAlias(keyType, issuers, socket) : _alias;
+        return _alias != null ? _alias : _delegate.chooseClientAlias(keyType, issuers, socket);
     }
 
     @Override
     public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
     {
-        LOGGER.debug("chooseServerAlias:Returning alias {}", _alias);
-        return _alias;
+        return _alias != null ? _alias : _delegate.chooseServerAlias(keyType, issuers, socket);
     }
 
     @Override
@@ -76,32 +69,30 @@ public class QpidServerX509KeyManager extends X509ExtendedKeyManager
     @Override
     public String[] getClientAliases(String keyType, Principal[] issuers)
     {
-        return _delegate.getClientAliases(keyType, issuers);
+        return _alias != null ? new String[] {_alias} : _delegate.getClientAliases(keyType,
issuers);
     }
 
     @Override
-    public PrivateKey getPrivateKey(String alias)
+    public String[] getServerAliases(String keyType, Principal[] issuers)
     {
-        return _delegate.getPrivateKey(alias);
+        return _alias != null ? new String[] {_alias} : _delegate.getServerAliases(keyType,
issuers);
     }
 
     @Override
-    public String[] getServerAliases(String keyType, Principal[] issuers)
+    public PrivateKey getPrivateKey(String alias)
     {
-        LOGGER.debug("getServerAliases:Returning alias {}", _alias);
-        return new String[]{_alias};
+        return _delegate.getPrivateKey(alias);
     }
 
     @Override
     public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine
engine)
     {
-        return _alias == null ? _delegate.chooseEngineClientAlias(keyType, issuers, engine)
: _alias;
+        return _alias != null ? _alias : _delegate.chooseEngineClientAlias(keyType, issuers,
engine);
     }
 
     @Override
     public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine
engine)
     {
-        LOGGER.debug("chooseEngineServerAlias:Returning alias {}", _alias);
-        return _alias;
+        return _alias != null ? _alias : _delegate.chooseEngineServerAlias(keyType, issuers,
engine);
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message