qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r742267 - in /qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/jms/ common/src/main/java/org/apache/qpid/transport/ tools/src/main/java/org/apache/qpid/tools/
Date Mon, 09 Feb 2009 05:14:13 GMT
Author: rajith
Date: Mon Feb  9 05:14:09 2009
New Revision: 742267

URL: http://svn.apache.org/viewvc?rev=742267&view=rev
Log:
This is related to QPID-1645
Added support to specify the sasl_mechs as a space separated list in the connection URL.
By default it will use PLAIN.
You could provide a list of mechs to support or force to use one GASSAPI or CRAM-MD5 by specifying
only that in the connection URL.

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java
    qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
    qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java
    qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java?rev=742267&r1=742266&r2=742267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java Mon Feb
 9 05:14:09 2009
@@ -35,6 +35,7 @@
     public static final String OPTIONS_CONNECT_TIMEOUT = "connecttimeout";
     public static final String OPTIONS_CONNECT_DELAY = "connectdelay";
     public static final String OPTIONS_IDLE_TIMEOUT = "idle_timeout";
+    public static final String OPTIONS_SASL_MECHS = "sasl_mechs";
     public static final int DEFAULT_PORT = 5672;
 
     public static final String SOCKET = "socket";

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java?rev=742267&r1=742266&r2=742267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
(original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/ClientDelegate.java
Mon Feb  9 05:14:09 2009
@@ -46,12 +46,21 @@
     private String vhost;
     private String username;
     private String password;
-
-    public ClientDelegate(String vhost, String username, String password)
+    private String[] saslMechs;
+    private String protocol;
+    private String serverName;
+    
+    public ClientDelegate(String vhost, String username, String password,String saslMechs)
     {
         this.vhost = vhost;
         this.username = username;
         this.password = password;
+        this.saslMechs = saslMechs.split(" ");
+        
+        // Looks kinda of silly but the Sun SASL Kerberos client uses the 
+        // protocol + servername as the service key.
+        this.protocol = System.getProperty("qpid.sasl_protocol","AMQP");
+        this.serverName = System.getProperty("qpid.sasl_server_name","localhost");
     }
 
     public void init(Connection conn, ProtocolHeader hdr)
@@ -84,7 +93,7 @@
                 new UsernamePasswordCallbackHandler();
             handler.initialise(username, password);
             SaslClient sc = Sasl.createSaslClient
-                (new String[] {"PLAIN"}, null, "AMQP", "localhost", null, handler);
+                (saslMechs, null, protocol, serverName, null, handler);
             conn.setSaslClient(sc);
 
             byte[] response = sc.hasInitialResponse() ?

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java?rev=742267&r1=742266&r2=742267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java Mon
Feb  9 05:14:09 2009
@@ -161,14 +161,19 @@
     {
         connect(host, port, vhost, username, password, false);
     }
-
+    
     public void connect(String host, int port, String vhost, String username, String password,
boolean ssl)
     {
+        connect(host, port, vhost, username, password, false,"PLAIN");
+    }
+
+    public void connect(String host, int port, String vhost, String username, String password,
boolean ssl,String saslMechs)
+    {
         synchronized (lock)
         {
             state = OPENING;
 
-            delegate = new ClientDelegate(vhost, username, password);
+            delegate = new ClientDelegate(vhost, username, password,saslMechs);
 
             IoTransport.connect(host, port, ConnectionBinding.get(this), ssl);
             send(new ProtocolHeader(1, 0, 10));

Modified: qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java?rev=742267&r1=742266&r2=742267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java (original)
+++ qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/JNDICheck.java Mon Feb
 9 05:14:09 2009
@@ -187,7 +187,7 @@
             print("ConnectionURL:");
             print(factory.getConnectionURL().toString());
             print("FailoverPolicy");
-            print(new FailoverPolicy(factory.getConnectionURL()).toString());
+            print(new FailoverPolicy(factory.getConnectionURL(),null).toString());
             print("");
         }
     }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message