Package org.apache.cxf.configuration.security

Examples of org.apache.cxf.configuration.security.SSLServerPolicy


        JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus, "http", 1234);
        assertFalse("SSLServerPolicy must not be set", engine.isSetSslServer());
        engine = JettyHTTPServerEngine.getForPort(bus, "http", 1235, null);
        assertFalse("SSLServerPolicy must not be set", engine.isSetSslServer());
        JettyHTTPServerEngine engine2 = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                   new SSLServerPolicy());
        assertFalse("SSLServerPolicy must not be set for already intialized engine",
                    engine2.isSetSslServer());
        JettyHTTPServerEngine.destroyForPort(1234);
        JettyHTTPServerEngine.destroyForPort(1235);
    }
View Full Code Here


        JettyHTTPServerEngine.destroyForPort(1235);
    }
   
    @Test
    public void testDestinationSSLServerPolicy() {
        SSLServerPolicy policy = new SSLServerPolicy();
        JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                                        policy);
        assertTrue("SSLServerPolicy must be set", engine.getSslServer() == policy);
        JettyHTTPServerEngine engine2 = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                   new SSLServerPolicy());
        assertTrue("Engine references for the same port should point to the same instance",
                   engine == engine2);
        assertTrue("SSLServerPolicy must not be set for already intialized engine",
                    engine.getSslServer() == policy);
       
View Full Code Here

    }
    */
   
    public void testSetAllData() {      
        String keyStoreStr = getPath("resources/defaultkeystore");
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        sslServerPolicy.setKeystore(keyStoreStr);
        sslServerPolicy.setKeystoreType("JKS");
       
        sslServerPolicy.setKeyPassword("defaultkeypass");
        sslServerPolicy.setKeystorePassword("defaultkeypass");
        sslServerPolicy.setTrustStoreType("JKS");
        sslServerPolicy.setTrustStoreAlgorithm("JKS");
        sslServerPolicy.setSecureSocketProtocol("TLSv1");
        sslServerPolicy.setSessionCacheKey("Anything");
        sslServerPolicy.setSessionCaching(true);
        sslServerPolicy.setMaxChainLength(new Long(2));
        sslServerPolicy.setCertValidator("Anything");

        String trustStoreStr = getPath("resources/defaulttruststore");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslListenerFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);

        factory.decorate(sslListener);
       
        assertTrue("Keystore not set properly",
                   sslListener.getKeystore().contains("resources/defaultkeystore"));
        String trustStr = System.getProperty("javax.net.ssl.trustStore");
        assertTrue("Trust store loaded success message not present",
                   trustStr.contains("resources/defaulttruststore"));
        assertTrue("Keystore type not being read",
                   sslListener.getKeystoreType().equals("JKS"));
        assertTrue("Keystore password not being read",
                   sslServerPolicy.getKeystorePassword().equals("defaultkeypass"));
        assertTrue("Key password not being read",
                   sslServerPolicy.getKeyPassword().equals("defaultkeypass"))
       
        assertTrue("Ciphersuites is being being read from somewhere unknown",
                   sslListener.getCipherSuites() == null);
        assertTrue("Truststore type not being read",
                   handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
View Full Code Here

                   handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                  + "CertValidator"));
    }
   
    public void testSetAllDataExceptKeystoreAndTrustStore() {       
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        sslServerPolicy.setKeystore(null);
        sslServerPolicy.setKeystoreType("JKS");
       
        sslServerPolicy.setKeyPassword("defaultkeypass");
        sslServerPolicy.setKeystorePassword("defaultkeypass");
        sslServerPolicy.setTrustStoreType("JKS");
        sslServerPolicy.setTrustStoreAlgorithm("JKS");
        sslServerPolicy.setSecureSocketProtocol("TLSv1");
        sslServerPolicy.setSessionCacheKey("Anything");
        sslServerPolicy.setSessionCaching(true);
        sslServerPolicy.setMaxChainLength(new Long(2));
        sslServerPolicy.setCertValidator("Anything");
       
        sslServerPolicy.setTrustStore(null);
        TestLogHandler handler = new TestLogHandler();
        JettySslListenerFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);

        factory.decorate(sslListener);
       
        assertTrue("Keystore not set properly, sslListener.getKeystore() = " + sslListener.getKeystore(),
                   sslListener.getKeystore().contains(".keystore"));
        String trustStr = System.getProperty("javax.net.ssl.trustStore");
        assertTrue("Trust store loaded success message not present",
                   trustStr.contains("cacerts"));
        assertTrue("Keystore type not being read",
                   sslListener.getKeystoreType().equals("JKS"));
        assertTrue("Keystore password not being read",
                   sslServerPolicy.getKeystorePassword().equals("defaultkeypass"));
        assertTrue("Key password not being read",
                   sslServerPolicy.getKeyPassword().equals("defaultkeypass"))
       
        assertTrue("Ciphersuites is being being read from somewhere unknown",
                   sslListener.getCipherSuites() == null);
        assertTrue("Truststore type not being read",
                   handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
View Full Code Here

                                                  + "CertValidator"));
    }

    public void testAllValidDataJKS() {       
        String keyStoreStr = getPath("resources/defaultkeystore");
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        sslServerPolicy.setKeystore(keyStoreStr);
        sslServerPolicy.setKeyPassword("defaultkeypass");
        sslServerPolicy.setKeystorePassword("defaultkeypass");
       
        sslServerPolicy.setKeystoreType("JKS");
        String trustStoreStr = getPath("resources/defaulttruststore");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslListenerFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

        factory.decorate(sslListener);
    }
   
    public void testAllValidDataPKCS12() {
        String keyStoreStr = getPath("resources/celtix.p12");
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        sslServerPolicy.setKeystore(keyStoreStr);
        sslServerPolicy.setKeyPassword("celtixpass");
        sslServerPolicy.setKeystorePassword("celtixpass");
       
        sslServerPolicy.setKeystoreType("PKCS12");
        String trustStoreStr = getPath("resources/abigcompany_ca.pem");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslListenerFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

        factory.decorate(sslListener);
    }

    public void testAllElementsHaveSetupMethod() {
        SSLServerPolicy policy = new SSLServerPolicy();
        TestLogHandler handler = new TestLogHandler();
        JettySslListenerFactory factory = createFactory(policy,
                                                        "https://dummyurl",
                                                         handler);
        assertTrue("A new element has been "
View Full Code Here

        JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus, "http", 1234);
        assertFalse("SSLServerPolicy must not be set", engine.isSetSslServer());
        engine = JettyHTTPServerEngine.getForPort(bus, "http", 1235, null);
        assertFalse("SSLServerPolicy must not be set", engine.isSetSslServer());
        JettyHTTPServerEngine engine2 = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                   new SSLServerPolicy());
        assertFalse("SSLServerPolicy must not be set for already intialized engine",
                    engine2.isSetSslServer());
        JettyHTTPServerEngine.destroyForPort(1234);
        JettyHTTPServerEngine.destroyForPort(1235);
    }
View Full Code Here

   
    public void testDestinationSSLServerPolicy() {
       
        setUpConfigurer(null);
       
        SSLServerPolicy policy = new SSLServerPolicy();
        JettyHTTPServerEngine engine = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                                        policy);
        assertTrue("SSLServerPolicy must be set", engine.getSslServer() == policy);
        JettyHTTPServerEngine engine2 = JettyHTTPServerEngine.getForPort(bus, "http", 1234,
                                                   new SSLServerPolicy());
        assertTrue("Engine references for the same port should point to the same instance",
                   engine == engine2);
        assertTrue("SSLServerPolicy must not be set for already intialized engine",
                    engine.getSslServer() == policy);
       
View Full Code Here

TOP

Related Classes of org.apache.cxf.configuration.security.SSLServerPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.