Thanks Willem.  I was having issues configuring the keystore and truststore. 
I tried implementing the HttpClientConfigurer below but I am not seeing the
keystore and specified truststore loading up in the javax.net.debug during
SSL handshake.  I only see the default jre/lib/security/cacerts truststore
loading up.  
Am I missing anything in MyHttpClientConfigurer or MyRouteBuilder. Or
possible in MainApp?  

public class MyHttpClientConfigurer implements HttpClientConfigurer {
    public void configureHttpClient(HttpClientBuilder client) {
        try {
                KeyStore keystore = KeyStore.getInstance("PKCS12");
            keystore.load(new FileInputStream(new
File("/etc/httpd/ssl/WS1909634885._.1.p12")), "password".toCharArray());

                KeyStore truststore = KeyStore.getInstance("JKS");;
        truststore.load(new FileInputStream(new
File("/usr/java/jdk1.6.0_45/jre/lib/security/cacertbak")),
"changeit".toCharArray());

                SchemeRegistry registry = new SchemeRegistry();
                registry.register(new Scheme("https", 443, new 
SSLSocketFactory(keystore,
"password", truststore)));
        } catch(Exception e) {
                System.out.println("In configureHttpClient" + e);
                e.printStackTrace();
        }
        }
}

public class MyRouteBuilder extends RouteBuilder {
    public void configure() {    
        from("jetty:http://server:4443/fdggwsapi/services";).process(new
MyProcessor()).to("https4://server:443/fdggwsapi/services?bridgeEndpoint=true&authMethod=Basic&authUsername=WS1909634900._.1&authPassword=password&authenticationPreemptive=true");
    }
    private void configureSslForHttp4()
    {
        HttpComponent httpComponent = getContext().getComponent("http4",
HttpComponent.class);
        httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer());
    }
}

public class MainApp {
    public static void main(String... args) throws Exception {
        Main main = new Main();
        main.enableHangupSupport();
        main.addRouteBuilder(new MyRouteBuilder());
        main.run(args);
        System.out.println("MainApp started - Hello");
    }
}




--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP-basic-authorization-with-HTTP4-tp5755181p5755212.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to