You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2018/03/19 12:41:42 UTC

[1/2] qpid-broker-j git commit: QPID-7567 : [Broker-J] Delegate consistently to underlying KeyManager

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 <kw...@apache.org>
Authored: Sat Mar 17 20:22:48 2018 +0000
Committer: Keith Wall <kw...@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


[2/2] qpid-broker-j git commit: QPID-8133: [Broker-J] Refresh Commons-CLI dependency (1.4)

Posted by kw...@apache.org.
QPID-8133: [Broker-J] Refresh Commons-CLI dependency (1.4)


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/89c69e7f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/89c69e7f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/89c69e7f

Branch: refs/heads/master
Commit: 89c69e7f08e9fdd606a7cbab4d18aef0f1132f1e
Parents: 3f0f558
Author: Keith Wall <kw...@apache.org>
Authored: Fri Mar 16 18:38:49 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Mon Mar 19 12:41:35 2018 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/qpid/server/Main.java  | 123 ++++++++++++++-----
 pom.xml                                         |   2 +-
 2 files changed, 90 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89c69e7f/broker/src/main/java/org/apache/qpid/server/Main.java
----------------------------------------------------------------------
diff --git a/broker/src/main/java/org/apache/qpid/server/Main.java b/broker/src/main/java/org/apache/qpid/server/Main.java
index 23ca469..31241e3 100644
--- a/broker/src/main/java/org/apache/qpid/server/Main.java
+++ b/broker/src/main/java/org/apache/qpid/server/Main.java
@@ -34,7 +34,6 @@ import java.util.TreeSet;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.HelpFormatter;
 import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
@@ -50,8 +49,8 @@ import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.SystemConfig;
 import org.apache.qpid.server.plugin.ProtocolEngineCreator;
 import org.apache.qpid.server.plugin.QpidServiceLoader;
-import org.apache.qpid.server.util.StringUtil;
 import org.apache.qpid.server.util.FileUtils;
+import org.apache.qpid.server.util.StringUtil;
 
 /**
  * Main entry point for Apache Qpid Broker-J.
@@ -70,38 +69,94 @@ public class Main
 
     private static final int MANAGEMENT_MODE_PASSWORD_LENGTH = 10;
 
-    private static final Option OPTION_HELP = new Option("h", "help", false, "print this message");
-
-    private static final Option OPTION_VERSION = new Option("v", "version", false, "print the version information and exit");
-
-    private static final Option OPTION_CONFIGURATION_STORE_PATH = OptionBuilder.withArgName("path").hasArg()
-            .withDescription("use given configuration store location").withLongOpt("store-path").create("sp");
-
-    private static final Option OPTION_CONFIGURATION_STORE_TYPE = OptionBuilder.withArgName("type").hasArg()
-            .withDescription("use given broker configuration store type").withLongOpt("store-type").create("st");
-
-    private static final Option OPTION_INITIAL_CONFIGURATION_PATH = OptionBuilder.withArgName("path").hasArg()
-            .withDescription("set the location of initial JSON config to use when creating/overwriting a broker configuration store").withLongOpt("initial-config-path").create("icp");
-
-    private static final Option OPTION_CREATE_INITIAL_CONFIG = OptionBuilder.withArgName("path").hasOptionalArg().withDescription("create a copy of the initial config file, either to an" +
-            " optionally specified file path, or as " + SystemConfig.DEFAULT_INITIAL_CONFIG_NAME + " in the current directory")
-            .withLongOpt("create-initial-config").create("cic");
-
-    private static final Option OPTION_CONFIGURATION_PROPERTY = OptionBuilder.withArgName("name=value").hasArg()
-            .withDescription("set a configuration property to use when resolving variables in the broker configuration store, with format \"name=value\"")
-            .withLongOpt("config-property").create("prop");
-
-    private static final Option OPTION_MANAGEMENT_MODE = OptionBuilder.withDescription("start broker in management mode, disabling the AMQP ports")
-            .withLongOpt("management-mode").create("mm");
-    private static final Option OPTION_MM_QUIESCE_VHOST = OptionBuilder.withDescription("make virtualhosts stay in the quiesced state during management mode.")
-            .withLongOpt("management-mode-quiesce-virtualhosts").create("mmqv");
-    private static final Option OPTION_MM_HTTP_PORT = OptionBuilder.withArgName("port").hasArg()
-            .withDescription("override http management port in management mode").withLongOpt("management-mode-http-port").create("mmhttp");
-    private static final Option OPTION_MM_PASSWORD = OptionBuilder.withArgName("password").hasArg()
-                                                                  .withDescription("Set the password for the management mode user " + SystemConfig.MANAGEMENT_MODE_USER_NAME).withLongOpt("management-mode-password").create("mmpass");
-
-    private static final Option OPTION_INITIAL_SYSTEM_PROPERTIES = OptionBuilder.withArgName("path").hasArg()
-            .withDescription("set the location of initial properties file to set otherwise unset system properties").withLongOpt("system-properties-file").create("props");
+    private static final Option OPTION_HELP = Option.builder("h")
+                                                    .desc("print this message")
+                                                    .longOpt("help")
+                                                    .build();
+
+    private static final Option OPTION_VERSION = Option.builder("v")
+                                                       .desc("print the version information and exit")
+                                                       .longOpt("version")
+                                                       .build();
+
+    private static final Option OPTION_CONFIGURATION_STORE_PATH = Option.builder("sp")
+                                                                        .argName("path")
+                                                                        .hasArg()
+                                                                        .desc("use given configuration store location")
+                                                                        .longOpt("store-path")
+                                                                        .build();
+
+    private static final Option OPTION_CONFIGURATION_STORE_TYPE = Option.builder("st")
+                                                                        .argName("type")
+                                                                        .hasArg()
+                                                                        .desc("use given broker configuration store "
+                                                                              + "type")
+                                                                        .longOpt("store-type")
+                                                                        .build();
+
+    private static final Option OPTION_INITIAL_CONFIGURATION_PATH = Option.builder("icp")
+                                                                          .argName("path")
+                                                                          .hasArg()
+                                                                          .desc("set the location of initial JSON "
+                                                                                + "config to use when "
+                                                                                + "creating/overwriting a broker "
+                                                                                + "configuration store")
+                                                                          .longOpt("initial-config-path")
+                                                                          .build();
+
+    private static final Option OPTION_CREATE_INITIAL_CONFIG = Option.builder("cic")
+                                                                     .argName("path")
+                                                                     .optionalArg(true)
+                                                                     .desc("create a copy of the initial config file,"
+                                                                           + " either to an"
+                                                                           +
+                                                                           " optionally specified file path, or as "
+                                                                           + SystemConfig.DEFAULT_INITIAL_CONFIG_NAME
+                                                                           + " in the current directory")
+                                                                     .longOpt("create-initial-config")
+                                                                     .build();
+
+    private static final Option OPTION_CONFIGURATION_PROPERTY = Option.builder("prop")
+                                                                      .argName("name=value").hasArg()
+                                                                      .desc("set a configuration property to use when"
+                                                                            + " resolving variables in the broker "
+                                                                            + "configuration store, with format "
+                                                                            + "\"name=value\"")
+                                                                      .longOpt("config-property")
+                                                                      .build();
+
+    private static final Option OPTION_MANAGEMENT_MODE = Option.builder("mm")
+                                                               .desc("start broker in management mode, disabling the "
+                                                                     + "AMQP ports")
+                                                               .longOpt("management-mode")
+                                                               .build();
+
+    private static final Option OPTION_MM_QUIESCE_VHOST = Option.builder("mmqv")
+                                                                .desc("make virtualhosts stay in the quiesced state during management mode.")
+                                                                .longOpt("management-mode-quiesce-virtualhosts")
+                                                                .build();
+
+    private static final Option OPTION_MM_HTTP_PORT = Option.builder("mmhttp")
+                                                            .argName("port")
+                                                            .hasArg()
+                                                            .desc("override http management port in management mode")
+                                                            .longOpt("management-mode-http-port")
+                                                            .build();
+
+    private static final Option OPTION_MM_PASSWORD = Option.builder("mmpass")
+                                                           .argName("password")
+                                                           .hasArg()
+                                                           .desc("Set the password for the management mode user "
+                                                                 + SystemConfig.MANAGEMENT_MODE_USER_NAME)
+                                                           .longOpt("management-mode-password")
+                                                           .build();
+
+    private static final Option OPTION_INITIAL_SYSTEM_PROPERTIES = Option.builder("props")
+                                                                         .argName("path")
+                                                                         .hasArg()
+                                                                         .desc("set the location of initial properties file to set otherwise unset system properties")
+                                                                         .longOpt("system-properties-file")
+                                                                         .build();
 
     private static final Options OPTIONS = new Options();
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/89c69e7f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7affd1f..eeb3e41 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,7 +126,7 @@
 
     <!-- dependency version numbers -->
     <bonecp-version>0.7.1.RELEASE</bonecp-version>
-    <commons-cli-version>1.2</commons-cli-version>
+    <commons-cli-version>1.4</commons-cli-version>
 
     <geronimo-jms-1-1-version>1.1.1</geronimo-jms-1-1-version>
     <geronimo-jms-2-0-version>1.0-alpha-2</geronimo-jms-2-0-version>


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