Examples of SSLContextParameters


Examples of org.apache.camel.util.jsse.SSLContextParameters

       
        // Note that this was set on the endpoint when it was constructed.  It was
        // either explicitly set at the component or on the endpoint, but either way,
        // the value is already set.  We therefore do not need to look at the component
        // level SSLContextParameters again in this method.
        SSLContextParameters endpointSslContextParameters = endpoint.getSslContextParameters();
       
        if (endpointSslContextParameters != null) {
            SslContextFactory contextFact = new SslContextFactory() {

                // This method is for Jetty 7.0.x ~ 7.4.x
                @SuppressWarnings("unused")
                public boolean checkConfig() {
                    if (getSslContext() == null) {
                        return checkSSLContextFactoryConfig(this);
                    } else {
                        return true;
                    }
                }
                // This method is for Jetty 7.5.x
                public void checkKeyStore() {
                    // here we don't check the SslContext as it is already created
                }
               
            };
            contextFact.setSslContext(endpointSslContextParameters.createSSLContext());
            for (Constructor<?> c : SslSelectChannelConnector.class.getConstructors()) {
                if (c.getParameterTypes().length == 1
                    && c.getParameterTypes()[0].isInstance(contextFact)) {
                    answer = (SslSelectChannelConnector)c.newInstance(contextFact);
                }
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

                                                              Boolean.class, true);
        Filter multipartFilter = resolveAndRemoveReferenceParameter(parameters, "multipartFilterRef", Filter.class);
        List<Filter> filters = resolveAndRemoveReferenceListParameter(parameters, "filtersRef", Filter.class);
        Long continuationTimeout = getAndRemoveParameter(parameters, "continuationTimeout", Long.class);
        Boolean useContinuation = getAndRemoveParameter(parameters, "useContinuation", Boolean.class);
        SSLContextParameters sslContextParameters = resolveAndRemoveReferenceParameter(parameters, "sslContextParametersRef", SSLContextParameters.class);
       
       
        // configure http client if we have url configuration for it
        // http client is only used for jetty http producer (hence not very commonly used)
        HttpClient client = null;
        if (IntrospectionSupport.hasProperties(parameters, "httpClient.") || sslContextParameters != null) {
            client = getNewHttpClient();
           
            if (IntrospectionSupport.hasProperties(parameters, "httpClient.")) {
                if (isExplicitHttpClient) {
                    LOG.warn("The user explicitly set an HttpClient instance on the component, "
                             + "but this endpoint provides HttpClient configuration.  Are you sure that "
                             + "this is what was intended?  Applying endpoint configuration to a new HttpClient instance "
                             + "to avoid altering existing HttpClient instances.");
                }
           
                // set additional parameters on http client
                IntrospectionSupport.setProperties(client, parameters, "httpClient.");
                // validate that we could resolve all httpClient. parameters as this component is lenient
                validateParameters(uri, parameters, "httpClient.");
            }
           
            // Note that the component level instance is already configured in getNewHttpClient.
            // We replace it here for endpoint level config.
            if (sslContextParameters != null) {
                if (isExplicitHttpClient) {
                    LOG.warn("The user explicitly set an HttpClient instance on the component, "
                             + "but this endpoint provides SSLContextParameters configuration.  Are you sure that "
                             + "this is what was intended?  Applying endpoint configuration to a new HttpClient instance "
                             + "to avoid altering existing HttpClient instances.");
                }
               
                ((CamelHttpClient) client).setSSLContext(sslContextParameters.createSSLContext());
            }
        } else {
            // Either we use the default one created by the component or we are using
            // one explicitly set by the end user, either way, we just use it as is.
            client = getHttpClient();
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

       
        // Note that this was set on the endpoint when it was constructed.  It was
        // either explicitly set at the component or on the endpoint, but either way,
        // the value is already set.  We therefore do not need to look at the component
        // level SSLContextParameters again in this method.
        SSLContextParameters endpointSslContextParameters = endpoint.getSslContextParameters();
       
        if (endpointSslContextParameters != null) {
            SslContextFactory contextFact = new SslContextFactory() {
                /**
                 * We are going to provide the context so none of the configuration options
                 * matter in the factory.  This method does not account for this scenario so
                 * we short-circuit it here to just let things go when the context is already
                 * provided.
                 */
                @Override
                public boolean checkConfig() {
                    if (getSslContext() == null) {
                        return super.checkConfig();
                    } else {
                        return true;
                    }
                }
               
            };
            contextFact.setSslContext(endpointSslContextParameters.createSSLContext());
            answer = new SslSelectChannelConnector(contextFact);
        } else {
            answer = new SslSelectChannelConnector();
            // with default null values, jetty ssl system properties
            // and console will be read by jetty implementation
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

        X509HostnameVerifier x509HostnameVerifier = resolveAndRemoveReferenceParameter(parameters, "x509HostnameVerifier", X509HostnameVerifier.class);
        if (x509HostnameVerifier == null) {
            x509HostnameVerifier = this.x509HostnameVerifier;
        }
       
        SSLContextParameters sslContextParameters = resolveAndRemoveReferenceParameter(parameters, "sslContextParametersRef", SSLContextParameters.class);
        if (sslContextParameters == null) {
            sslContextParameters = this.sslContextParameters;
        }
       
        boolean secure = HttpHelper.isSecureConnection(uri);
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

                                                              Boolean.class, true);
        Filter multipartFilter = resolveAndRemoveReferenceParameter(parameters, "multipartFilterRef", Filter.class);
        List<Filter> filters = resolveAndRemoveReferenceListParameter(parameters, "filtersRef", Filter.class);
        Long continuationTimeout = getAndRemoveParameter(parameters, "continuationTimeout", Long.class);
        Boolean useContinuation = getAndRemoveParameter(parameters, "useContinuation", Boolean.class);
        SSLContextParameters sslContextParameters = resolveAndRemoveReferenceParameter(parameters, "sslContextParametersRef", SSLContextParameters.class);
       
       
        // configure http client if we have url configuration for it
        // http client is only used for jetty http producer (hence not very commonly used)
        HttpClient client = null;
        if (IntrospectionSupport.hasProperties(parameters, "httpClient.") || sslContextParameters != null) {
            client = getNewHttpClient();
           
            if (IntrospectionSupport.hasProperties(parameters, "httpClient.")) {
                if (isExplicitHttpClient) {
                    LOG.warn("The user explicitly set an HttpClient instance on the component, "
                             + "but this endpoint provides HttpClient configuration.  Are you sure that "
                             + "this is what was intended?  Applying endpoint configuration to a new HttpClient instance "
                             + "to avoid altering existing HttpClient instances.");
                }
           
                // set additional parameters on http client
                IntrospectionSupport.setProperties(client, parameters, "httpClient.");
                // validate that we could resolve all httpClient. parameters as this component is lenient
                validateParameters(uri, parameters, "httpClient.");
            }
           
            // Note that the component level instance is already configured in getNewHttpClient.
            // We replace it here for endpoint level config.
            if (sslContextParameters != null) {
                if (isExplicitHttpClient) {
                    LOG.warn("The user explicitly set an HttpClient instance on the component, "
                             + "but this endpoint provides SSLContextParameters configuration.  Are you sure that "
                             + "this is what was intended?  Applying endpoint configuration to a new HttpClient instance "
                             + "to avoid altering existing HttpClient instances.");
                }
               
                ((CamelHttpClient) client).setSSLContext(sslContextParameters.createSSLContext());
            }
        } else {
            // Either we use the default one created by the component or we are using
            // one explicitly set by the end user, either way, we just use it as is.
            client = getHttpClient();
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

       
        // Note that this was set on the endpoint when it was constructed.  It was
        // either explicitly set at the component or on the endpoint, but either way,
        // the value is already set.  We therefore do not need to look at the component
        // level SSLContextParameters again in this method.
        SSLContextParameters endpointSslContextParameters = endpoint.getSslContextParameters();
       
        if (endpointSslContextParameters != null) {
            SslContextFactory contextFact = new SslContextFactory() {
                /**
                 * We are going to provide the context so none of the configuration options
                 * matter in the factory.  This method does not account for this scenario so
                 * we short-circuit it here to just let things go when the context is already
                 * provided.
                 */
                // This method is for Jetty 7.0.x ~ 7.4.x
                @SuppressWarnings("unused")
                public boolean checkConfig() {
                    if (getSslContext() == null) {
                        return checkSSLContextFactoryConfig(this);
                    } else {
                        return true;
                    }
                }
                // This method is for Jetty 7.5.x
                public void checkKeyStore() {
                    // here we don't check the SslContext as it is already created
                }
               
            };
            contextFact.setSslContext(endpointSslContextParameters.createSSLContext());
            answer = new SslSelectChannelConnector(contextFact);
        } else {
            answer = new SslSelectChannelConnector();
            // with default null values, jetty ssl system properties
            // and console will be read by jetty implementation
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

    @Test
    public void testJsseUtilNamespace() throws Exception {
        getInstalledBundle("CamelBlueprintTestBundle18").start();
        BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle18)", 10000);
       
        SSLContextParameters scp = (SSLContextParameters) ctn.getComponentInstance("sslContextParameters");
       
        assertEquals("TLS", scp.getSecureSocketProtocol());
       
        assertNotNull(scp.getKeyManagers());
        assertEquals("changeit", scp.getKeyManagers().getKeyPassword());
        assertNull(scp.getKeyManagers().getProvider());
        assertNotNull(scp.getKeyManagers().getKeyStore());
        assertNull(scp.getKeyManagers().getKeyStore().getType());
       
        assertNotNull(scp.getTrustManagers());
        assertNull(scp.getTrustManagers().getProvider());
        assertNotNull(scp.getTrustManagers().getKeyStore());
        assertNull(scp.getTrustManagers().getKeyStore().getType());
       
        assertNull(scp.getSecureRandom());
       
        assertNull(scp.getClientParameters());
       
        assertNull(scp.getServerParameters());
       
        assertEquals("test", scp.getCamelContext().getName());
       
        assertNotNull(scp.getCamelContext());
        assertNotNull(scp.getKeyManagers().getCamelContext());
        assertNotNull(scp.getKeyManagers().getKeyStore().getCamelContext());
        assertNotNull(scp.getTrustManagers().getCamelContext());
        assertNotNull(scp.getTrustManagers().getKeyStore().getCamelContext());
    }
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

        kmp.setKeyStore(ksp);
       
        TrustManagersParameters tmp = new TrustManagersParameters();
        tmp.setKeyStore(ksp);
       
        SSLContextParameters sslContextParameters = new SSLContextParameters();
        sslContextParameters.setSecureSocketProtocol("TLS");
        sslContextParameters.setKeyManagers(kmp);
        sslContextParameters.setTrustManagers(tmp);
       
        JndiRegistry registry = super.createRegistry();
        registry.bind("sslContextParameters", sslContextParameters);
        return registry;
    }
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

        ksp.setPassword("password");
       
        TrustManagersParameters tmp = new TrustManagersParameters();
        tmp.setKeyStore(ksp);
       
        SSLContextParameters sslContextParameters = new SSLContextParameters();
        sslContextParameters.setSecureSocketProtocol("TLS");
        sslContextParameters.setTrustManagers(tmp);
       
        JndiRegistry registry = super.createRegistry();
        registry.bind("sslContextParameters", sslContextParameters);
        return registry;
    }
View Full Code Here

Examples of org.apache.camel.util.jsse.SSLContextParameters

                kmp.setKeyStore(ksp);
               
                TrustManagersParameters tmp = new TrustManagersParameters();
                tmp.setKeyStore(ksp);

                SSLContextParameters sslContextParameters = new SSLContextParameters();
                sslContextParameters.setKeyManagers(kmp);
                sslContextParameters.setTrustManagers(tmp);
               
                CometdComponent component = (CometdComponent) context.getComponent("cometds");
                component.setSslContextParameters(sslContextParameters);

                from("direct:input").to(uri);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.