summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDavid Rosell2011-10-29 18:19:29 (EDT)
committer Jesse McConnell2011-11-02 15:37:02 (EDT)
commitc83b02c4a7de5e8e351039eba4b55f0773e45d1c (patch)
tree0fb7d00042a12ce7bf8d85b6a2450cc3372b7a61
parent25f70e90606cb12b017e1c6944ccbbeeaa89fabb (diff)
downloadorg.eclipse.jetty.project-c83b02c4a7de5e8e351039eba4b55f0773e45d1c.zip
org.eclipse.jetty.project-c83b02c4a7de5e8e351039eba4b55f0773e45d1c.tar.gz
org.eclipse.jetty.project-c83b02c4a7de5e8e351039eba4b55f0773e45d1c.tar.bz2
[Bug 362407] setTrustStore(Resource) -> setTrustStoreResource(R)
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java2
-rw-r--r--jetty-http/src/test/java/org/eclipse/jetty/http/SslContextFactoryTest.java67
2 files changed, 68 insertions, 1 deletions
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
index 4645a19..bb715c0 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/ssl/SslContextFactory.java
@@ -1377,7 +1377,7 @@ public class SslContextFactory extends AbstractLifeCycle
/** Set the trust store resource.
* @param resource the trust store resource to set
*/
- public void setTrustStore(Resource resource)
+ public void setTrustStoreResource(Resource resource)
{
checkNotStarted();
diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/SslContextFactoryTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/SslContextFactoryTest.java
index f7fce83..2812cec 100644
--- a/jetty-http/src/test/java/org/eclipse/jetty/http/SslContextFactoryTest.java
+++ b/jetty-http/src/test/java/org/eclipse/jetty/http/SslContextFactoryTest.java
@@ -6,6 +6,7 @@ import java.io.FileInputStream;
import java.security.KeyStore;
import org.eclipse.jetty.http.ssl.SslContextFactory;
+import org.eclipse.jetty.util.resource.Resource;
import org.junit.Test;
@@ -72,4 +73,70 @@ public class SslContextFactoryTest
cf.start();
assertTrue(cf.getSslContext()!=null);
}
+
+ @Test
+ public void testNoTsResourceKs() throws Exception
+ {
+ Resource keystoreResource = Resource.newSystemResource("keystore");
+
+ SslContextFactory cf = new SslContextFactory();
+ cf.setKeyStoreResource(keystoreResource);
+ cf.setKeyStorePassword("storepwd");
+ cf.setKeyManagerPassword("keypwd");
+
+ cf.start();
+
+ assertTrue(cf.getSslContext()!=null);
+
+ }
+
+ @Test
+ public void testResourceTsResourceKs() throws Exception
+ {
+ Resource keystoreResource = Resource.newSystemResource("keystore");
+ Resource truststoreResource = Resource.newSystemResource("keystore");
+
+ SslContextFactory cf = new SslContextFactory();
+ cf.setKeyStoreResource(keystoreResource);
+ cf.setTrustStoreResource(truststoreResource);
+ cf.setKeyStorePassword("storepwd");
+ cf.setKeyManagerPassword("keypwd");
+ cf.setTrustStorePassword("storepwd");
+
+ cf.start();
+
+ assertTrue(cf.getSslContext()!=null);
+ }
+
+ @Test(expected = java.security.UnrecoverableKeyException.class)
+ public void testResourceTsResourceKsWrongPW() throws Exception
+ {
+ Resource keystoreResource = Resource.newSystemResource("keystore");
+ Resource truststoreResource = Resource.newSystemResource("keystore");
+
+ SslContextFactory cf = new SslContextFactory();
+ cf.setKeyStoreResource(keystoreResource);
+ cf.setTrustStoreResource(truststoreResource);
+ cf.setKeyStorePassword("storepwd");
+ cf.setKeyManagerPassword("wrong_keypwd");
+ cf.setTrustStorePassword("storepwd");
+
+ cf.start();
+ }
+
+ @Test(expected = java.io.IOException.class)
+ public void testResourceTsWrongPWResourceKs() throws Exception
+ {
+ Resource keystoreResource = Resource.newSystemResource("keystore");
+ Resource truststoreResource = Resource.newSystemResource("keystore");
+
+ SslContextFactory cf = new SslContextFactory();
+ cf.setKeyStoreResource(keystoreResource);
+ cf.setTrustStoreResource(truststoreResource);
+ cf.setKeyStorePassword("storepwd");
+ cf.setKeyManagerPassword("keypwd");
+ cf.setTrustStorePassword("wrong_storepwd");
+
+ cf.start();
+ }
}