smq
2015-04-10 21:51:31 UTC
I don't know how to programmatically disable CN checking with CXF 3.0.4
JAX-RS 2.0 client. My code is as follows:
System.setProperty("jsse.enableSNIExtension", "false");
HttpsURLConnection.setDefaultHostnameVerifier(
new HostnameVerifier(){
public boolean verify(String hostname,
SSLSession sslSession) {
return true;
}
});
Client client = ClientBuilderImpl.newClient();
String urlHost = "https://" + centralNode;
WebTarget target = client.target(urlHost).path(BASE_SERVICE_URL);
String encodedpw = Base64.encodeBase64String(passwd.getBytes());
String body = "{\"uid\" : \"" + uid + "\",\"password\": \"" + encodedpw +
"\"}";
logger.info("json body=" +body);
Response res =
target.request(MediaType.APPLICATION_JSON).post(Entity.entity(body,
MediaType.APPLICATION_JSON));
As you can see, I already tried to override the default hostnameverifier,
and set jsse.enableSNIExtension to false. None of these worked, i am still
getting the exception:
"The https URL hostname does not match the Common Name (CN) on the server
certificate in the client's truststore. Make sure server certificate is
correct, or to disable this check (NOT recommended for production) set the
CXF client TLS configuration property "disableCNCheck" to true."
Please help!
--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-3-0-4-client-how-to-disable-CN-checking-tp5755938.html
Sent from the cxf-user mailing list archive at Nabble.com.
JAX-RS 2.0 client. My code is as follows:
System.setProperty("jsse.enableSNIExtension", "false");
HttpsURLConnection.setDefaultHostnameVerifier(
new HostnameVerifier(){
public boolean verify(String hostname,
SSLSession sslSession) {
return true;
}
});
Client client = ClientBuilderImpl.newClient();
String urlHost = "https://" + centralNode;
WebTarget target = client.target(urlHost).path(BASE_SERVICE_URL);
String encodedpw = Base64.encodeBase64String(passwd.getBytes());
String body = "{\"uid\" : \"" + uid + "\",\"password\": \"" + encodedpw +
"\"}";
logger.info("json body=" +body);
Response res =
target.request(MediaType.APPLICATION_JSON).post(Entity.entity(body,
MediaType.APPLICATION_JSON));
As you can see, I already tried to override the default hostnameverifier,
and set jsse.enableSNIExtension to false. None of these worked, i am still
getting the exception:
"The https URL hostname does not match the Common Name (CN) on the server
certificate in the client's truststore. Make sure server certificate is
correct, or to disable this check (NOT recommended for production) set the
CXF client TLS configuration property "disableCNCheck" to true."
Please help!
--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-3-0-4-client-how-to-disable-CN-checking-tp5755938.html
Sent from the cxf-user mailing list archive at Nabble.com.