我們有一個基於spring-boot的web應用程序並使用WSO2 CEP框架。我們如何忽略AXIS2客戶端的主機名驗證或設置自定義主機名驗證程序?如何在AXIS2客戶端中忽略主機名驗證或設置驗證程序
我們可以爲Java HttpsURLConnection的
HttpsURLConnection.setDefaultHostnameVerifier(new WildcardHostnameVerifier());
做這做這樣的Apache HttpClient的
// setup a WildcardHostNameVerifier for support verifying the hostname of wildcard certificate
sslsf = new SSLConnectionSocketFactory(sslcontext, new WildcardHostnameVerifier());
CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
但不知道如何爲Axis2客戶機做的,我們已經找到了一種方法來設置只能定製trustManger。
final SSLContext sslCtx = SSLContext.getInstance("TLSv1.2");
sslCtx.init(null, new TrustManager[] { new CustomX509TrustManager() }, new SecureRandom());
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, new Protocol("https",
(ProtocolSocketFactory) new SSLProtocolSocketFactory(sslCtx), 443));
這會有幫助嗎? http://grepcode.com/file/repo1.maven.org/maven2/org.apache.axis2/axis2-kernel/1.4/org/apache/axis2/transport/nhttp/HttpCoreNIOSSLSender.java – ycr
感謝您的回覆,ycr 。如果我可以擴展它並定製verify(),這可能會很有用。但是,我們使用的wso2-cep-client 1.0.10與axis2-kernel 1.6.4存在依賴關係。似乎沒有HttpCoreNIOSSLSender了? – Bruce
我該怎麼做才能在設置SSLIOSessionHandler後得到它?謝謝 – Bruce