diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-22 22:38:31 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2010-03-22 22:38:31 +0000 |
| commit | 445d8f537fefde2bd122469474ae9113928d1275 (patch) | |
| tree | 0a900d73a21a65a9e7ff4639fbbe61a3efbe2061 /java/systests/src | |
| parent | 3d31ccffd3d37ce488d82c7f649d5a15b98e431c (diff) | |
| download | qpid-python-445d8f537fefde2bd122469474ae9113928d1275.tar.gz | |
This is related to QPID-2447
Added QpidClientX509KeyManager (a customer KeyManager) which will return the ssl_client_alias specified in the Connection URL.
Note the alias here is actually the certificate name and not the alias used in the keytool.
I also fixed a minor bug in SSLUtil to retrive the identitiy of the local certificate instead of the peer's certificate.
Added a test for the above JIRA.
Added AMQTestConnection_0_10 which allows the SecurityLayer to be exposed for testing purposes.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@926380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests/src')
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java b/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java index 05118ffc0e..74326c02ec 100644 --- a/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java +++ b/java/systests/src/main/java/org/apache/qpid/client/ssl/SSLTest.java @@ -6,10 +6,27 @@ import java.io.PrintStream; import javax.jms.Session; import org.apache.qpid.client.AMQConnection; +import org.apache.qpid.client.AMQTestConnection_0_10; import org.apache.qpid.test.utils.QpidTestCase; +import org.apache.qpid.transport.Connection; public class SSLTest extends QpidTestCase { + + @Override + protected void setUp() throws Exception + { + System.setProperty("javax.net.debug", "ssl"); + super.setUp(); + } + + @Override + protected void tearDown() throws Exception + { + System.setProperty("javax.net.debug", ""); + super.tearDown(); + } + public void testCreateSSLContextFromConnectionURLParams() { if (Boolean.getBoolean("profile.use_ssl")) @@ -52,6 +69,32 @@ public class SSLTest extends QpidTestCase } } } + + public void testMultipleCertsInSingleStore() throws Exception + { + if (Boolean.getBoolean("profile.use_ssl")) + { + String url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" + + System.getProperty("test.port.ssl") + + "?ssl='true'&ssl_cert_alias='app1''"; + + AMQTestConnection_0_10 con = new AMQTestConnection_0_10(url); + Connection transportCon = con.getConnection(); + String userID = transportCon.getSecurityLayer().getUserID(); + assertEquals("The correct certificate was not choosen","app1@acme.org",userID); + con.close(); + + url = "amqp://guest:guest@test/?brokerlist='tcp://localhost:" + + System.getProperty("test.port.ssl") + + "?ssl='true'&ssl_cert_alias='app2''"; + + con = new AMQTestConnection_0_10(url); + transportCon = con.getConnection(); + userID = transportCon.getSecurityLayer().getUserID(); + assertEquals("The correct certificate was not choosen","app2@acme.org",userID); + con.close(); + } + } public void testVerifyHostName() { |
