Package org.objectweb.celtix.bus.configuration.security

Examples of org.objectweb.celtix.bus.configuration.security.SSLServerPolicy


        port = p;
        config = createConfiguration(bus, port);
        policy = config.getObject(HTTPListenerPolicy.class, "httpListener");
        sslPolicy = config.getObject(SSLServerPolicy.class, "sslServer");
        if (sslPolicy == null && "https".equals(protocol)) {
            sslPolicy = new SSLServerPolicy();
        }
    }
View Full Code Here


   
    public void testSecurityConfigurer() {
        try {
            System.setProperty("celtix.security.configurer.celtix.null",
                               "org.objectweb.celtix.bus.transports.https.SetAllDataSecurityDataProvider");
            SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
            TestHandler handler = new TestHandler();
            JettySslListenerConfigurer jettySslListenerConfigurer =
                                createJettySslListenerConfigurer(sslServerPolicy,
                                                               "https://dummyurl",
                                                               handler);
   
            jettySslListenerConfigurer.configure();
            SslListener sslListener = jettySslListenerConfigurer.getSslListener();
            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 not being read from the config provider",
                       sslListener.getCipherSuites()[0].equals("MyCipher"));
            assertTrue("Truststore type not being read",
                       handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                      + "TrustStoreType"));         
   
            assertTrue("Secure socket protocol not being read",
                       handler.checkLogContainsString("The secure socket protocol has been set to TLSv1."));
            assertTrue("Session caching set but no warning about not supported",
                       handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                      + "SessionCaching"));
            assertTrue("SessionCacheKey caching set but no warning about not supported",
                       handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                      + "SessionCacheKey"));
            assertTrue("MaxChainLength caching set but no warning about not supported",
                       handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                      + "MaxChainLength"));
            assertTrue("CertValidator caching set but no warning about not supported",
                       handler.checkLogContainsString("Unsupported SSLServerPolicy property : "
                                                      + "CertValidator"));
           
            System.setProperty("celtix.security.configurer.celtix.null",
                "org.objectweb.celtix.bus.transports.https.DoesNotExistSetAllDataSecurityDataProvider");
            SSLServerPolicy sslServerPolicy2 = new SSLServerPolicy();
            TestHandler handler2 = new TestHandler();
            EasyMock.reset(configuration);
            configuration = EasyMock.createMock(Configuration.class);
            JettySslListenerConfigurer jettySslListenerConfigurer2 =
                createJettySslListenerConfigurer(sslServerPolicy2,
                                            "https://dummyurl",
                                            handler2);
            sslServerPolicy2.setKeyPassword("test");
            sslServerPolicy2.setKeystorePassword("test1");
            jettySslListenerConfigurer2.configure();
           
            assertTrue("Keystore not set properly",
                       handler2.checkLogContainsString("Failure invoking on custom security configurer "
                                 + "org.objectweb.celtix.bus.transports.https."
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);
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
                            createJettySslListenerConfigurer(sslServerPolicy,
                                                           "https://dummyurl",
                                                           handler);

        jettySslListenerConfigurer.configure();
        SslListener sslListener =
                jettySslListenerConfigurer.getSslListener();
       
        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

                                                  + "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);
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
                            createJettySslListenerConfigurer(sslServerPolicy,
                                                           "https://dummyurl",
                                                           handler);

        jettySslListenerConfigurer.configure();
        SslListener sslListener =
                jettySslListenerConfigurer.getSslListener();
       
        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

    }

    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);
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
                            createJettySslListenerConfigurer(sslServerPolicy,
                                                           "https://dummyurl",
                                                           handler);
View Full Code Here

    }
   
    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);
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
                            createJettySslListenerConfigurer(sslServerPolicy,
                                                           "https://dummyurl",
                                                           handler);
View Full Code Here

   
       
   
    public void testAllElementsHaveSetupMethod() {
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
            createJettySslListenerConfigurer(sslServerPolicy,
                                           "https://dummyurl",
                                           handler);
View Full Code Here

    }
    public void testSetAllData() {
       
        String keyStoreStr = getPath("resources/defaultkeystore");
        SSLServerPolicy sslServerPolicy = new SSLServerPolicy();
        System.setProperty("javax.net.ssl.keyStore", keyStoreStr);
        System.setProperty("javax.net.ssl.keyStorePassword", "defaultkeypass");
        sslServerPolicy.setTrustStoreType("JKS");
        sslServerPolicy.setTrustStoreAlgorithm("JKS");
        sslServerPolicy.setSecureSocketProtocol("TLSv1");
        sslServerPolicy.setKeystoreAlgorithm("Anything");
        sslServerPolicy.setSessionCacheKey("Anything");
        sslServerPolicy.setSessionCaching(true);
        sslServerPolicy.setMaxChainLength(new Long(2));
        sslServerPolicy.setCertValidator("Anything");

       
        String trustStoreStr = getPath("resources/defaulttruststore");
        System.setProperty("javax.net.ssl.trustStore", trustStoreStr);
        TestHandler handler = new TestHandler();
        JettySslListenerConfigurer jettySslListenerConfigurer =
                            createJettySslListenerConfigurer(sslServerPolicy,
                                                           "https://dummyurl",
                                                           handler);

        jettySslListenerConfigurer.configure();
        SslListener sslListener =
                jettySslListenerConfigurer.getSslListener();
       
        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("PKCS12"));
        assertTrue("Couldn't deal with case when SSLServerPolicy keystore password  is null",
                   sslServerPolicy.getKeystorePassword() == null);
        assertTrue("Couldn't deal with case when SSLServerPolicy key password  is null",
                   sslServerPolicy.getKeyPassword() == null)
       
        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

TOP

Related Classes of org.objectweb.celtix.bus.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.