Package org.apache.cxf.configuration.security

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


        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setName(new QName("bla", "Service"));       
        endpointInfo = new EndpointInfo(serviceInfo, "");
        endpointInfo.setName(new QName("bla", "Port"));
        endpointInfo.addExtensor(policy);
        endpointInfo.addExtensor(new SSLServerPolicy());
       
        engine = EasyMock.createMock(ServerEngine.class);
        EasyMock.replay();
        endpointInfo.setAddress(NOWHERE + "bar/foo");
       
View Full Code Here


        endpointInfo.setName(new QName("bla", "Port"));
        endpointInfo.setAddress(NOWHERE + "bar/foo");
      
        endpointInfo.addExtensor(policy);
        endpointInfo.getExtensor(SSLServerPolicy.class);
        endpointInfo.addExtensor(new SSLServerPolicy());
        engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")),
                          EasyMock.isA(JettyHTTPHandler.class));
        EasyMock.expectLastCall();
        EasyMock.replay(engine);
       
View Full Code Here

    */
   
    @Test
    public void testSetAllData() throws Exception {      
        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();
        JettySslConnectorFactory factory = null;
        String oldHome = overrideHome();
        try {           
            factory = createFactory(sslServerPolicy,
                                    "https://dummyurl",
                                    handler);

            factory.decorate(sslConnector);
        } finally {
            restoreHome(oldHome);
        }
       
        assertTrue("Keystore not set properly",
                   sslConnector.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",
                   sslConnector.getKeystoreType().equals("JKS"));
        assertTrue("Keystore password not being read",
                   sslServerPolicy.getKeystorePassword().equals("defaultkeypass"));
        assertTrue("Key password not being read",
                   sslServerPolicy.getKeyPassword().equals("defaultkeypass"))
       
        //assertNotNull("Default filtered ciphersuites not set on listener",
        //              sslConnector.getExcludeCipherSuites());

        assertTrue("Truststore type not being read",
View Full Code Here

                                                  + "CertValidator"));
    }
   
    @Test
    public void testSetAllDataExceptKeystoreAndTrustStore() throws Exception {       
        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();
        JettySslConnectorFactory factory = null;
        String oldHome = overrideHome();
        try {           
            factory = createFactory(sslServerPolicy,
                                    "https://dummyurl",
                                    handler);

            factory.decorate(sslConnector);
        } finally {
            restoreHome(oldHome);
        }
       
        assertTrue("Keystore not set properly, sslListener.getKeystore() = " + sslConnector.getKeystore(),
                   sslConnector.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",
                   sslConnector.getKeystoreType().equals("JKS"));
        assertTrue("Keystore password not being read",
                   sslServerPolicy.getKeystorePassword().equals("defaultkeypass"));
        assertTrue("Key password not being read",
                   sslServerPolicy.getKeyPassword().equals("defaultkeypass"))
       
        assertNull("Ciphersuites is being being read from somewhere unknown",
                   sslConnector.getExcludeCipherSuites());       
        assertTrue("Truststore type not being read",
View Full Code Here

                                                  + "CertValidator"));
    }
    @Test
    public void testConfiguredCipherSuites() throws Exception {      
        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");       
        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
            sslServerPolicy.getCiphersuites().add(EXPORT_CIPHERS[i]);
        }
        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
            sslServerPolicy.getCiphersuites().add(NON_EXPORT_CIPHERS[i]);
        }

        String trustStoreStr = getPath("resources/defaulttruststore");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslConnectorFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here


    @Test
    public void testDefaultedCipherSuiteFilters() throws Exception {      
        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");

        String trustStoreStr = getPath("resources/defaulttruststore");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslConnectorFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

    }

    @Test
    public void testNonDefaultedCipherSuiteFilters() throws Exception {      
        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");

        // reverse default sense of include/exlcude
        FiltersType filters = new ObjectFactory().createFiltersType();
        for (int i = 0; i < NON_EXPORT_CIPHERS.length; i++) {
            filters.getInclude().add(NON_EXPORT_CIPHERS[i]);
        }
        for (int i = 0; i < EXPORT_CIPHERS.length; i++) {
            filters.getExclude().add(EXPORT_CIPHERS[i]);
        }
        sslServerPolicy.setCiphersuiteFilters(filters);
       
        String trustStoreStr = getPath("resources/defaulttruststore");
        sslServerPolicy.setTrustStore(trustStoreStr);
        TestLogHandler handler = new TestLogHandler();
        JettySslConnectorFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

    }

    @Test
    public void testAllValidDataJKS() throws Exception {       
        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();
        JettySslConnectorFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

    }
   
    @Test
    public void testAllValidDataPKCS12() throws Exception {
        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();
        JettySslConnectorFactory factory = createFactory(sslServerPolicy,
                                                        "https://dummyurl",
                                                        handler);
View Full Code Here

        factory.decorate(sslConnector);
    }

    @Test
    public void testAllElementsHaveSetupMethod() throws Exception {
        SSLServerPolicy policy = new SSLServerPolicy();
        TestLogHandler handler = new TestLogHandler();
        JettySslConnectorFactory factory = createFactory(policy,
                                                        "https://dummyurl",
                                                         handler);
        assertTrue("A new element has been "
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.