You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Don Doffe <fo...@gmail.com> on 2011/07/04 12:41:55 UTC
HTTP4 Client + SSL + Accept All Hostnames + Accept All certificates
Hi,
has anyone been successfull with setting up a client endpoint that would
accept any given certificate/hostname?
The endpoint I'm trying to access has self signed certificate.
Camel 2.8.0
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/HTTP4-Client-SSL-Accept-All-Hostnames-Accept-All-certificates-tp4549626p4549626.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP4 Client + SSL + Accept All Hostnames + Accept All
certificates
Posted by Myriam Khairallah <my...@atos.net>.
Hi,
I need to do exactly the same as described in this topic, but it doesn't
work for me, neither with camel 2.8.0 nor with the newer camel version
2.10.3 - I still get "javax.net.ssl.SSLPeerUnverifiedException: peer not
authenticated".
Here is what I did:
My own HttpClientConfigurer:
public class MyHttpClientConfigurer implements HttpClientConfigurer {
@Override
public void configureHttpClient(HttpClient client) {
try {
SSLContext ctx = SSLContext.getInstance("SSL");
X509TrustManager tm = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] xcs,
String string) throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] xcs,
String string) throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx,
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
client.getConnectionManager().getSchemeRegistry().register(new
Scheme("https4", 443, ssf));
client.getConnectionManager().getSchemeRegistry().register(new
Scheme("http", 80,
PlainSocketFactory.getSocketFactory()));
client.getConnectionManager().getSchemeRegistry().register(new
Scheme("http4", 80,
PlainSocketFactory.getSocketFactory()));
System.out.println("Bla");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
The entry in my camel context file:
<bean id="myHttpClientConfigurer" class="my.package.MyHttpClientConfigurer"
/>
The call of the URL in the route:
from("direct:login")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.to("https4://my_url/index.jsp?httpClientConfigurer=myHttpClientConfigurer")
.end();
Am I missing something here ?
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/HTTP4-Client-SSL-Accept-All-Hostnames-Accept-All-certificates-tp4549626p5726238.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP4 Client + SSL + Accept All Hostnames + Accept All
certificates
Posted by Don Doffe <fo...@gmail.com>.
Thank you.
That worked.
And do I understand correctly that it will conflict with other configurers -
for instance Basic Authentication defined as authUsername and authPassword ?
--
View this message in context: http://camel.465427.n5.nabble.com/HTTP4-Client-SSL-Accept-All-Hostnames-Accept-All-certificates-tp4549626p4549859.html
Sent from the Camel - Users mailing list archive at Nabble.com.