我們需要在Google App Engine上實現雙向SSL,在這種情況下,我們使用JAX-WS將Web服務請求發送到服務器,以請求雙向SSL身份驗證。用於GAE上的Web服務的雙向SSL(java)
如何爲我們的傳出Web服務請求設置雙向SSL?
我們知道javax.net.ssl*
在App Engine環境中是被禁止的。
這裏是我們的代碼示例:或
ListenerSoap soap = new Listener().getListenerSoap();
soap.ping();
我想我們可以存儲密鑰庫中所需要的任何證書:
@WebService(name="ListenerSoap", targetNamespace = "http://example.com/Listener.Wsdl")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface ListenerSoap {
@WebMethod(operationName = "Ping", action="http://example.com/Listener.Wsdl#Ping")
public void ping();
}
@WebServiceClient(name="Listener", targetNamespace="http://example.com/Listener.Wsdl", wsdlLocation = "https://example.com/Listener.asmx?WSDL")
public class Listener extends Service
{
public ListenerSoap getListenerSoap() {
return super.getPort(new QName("http://example.com/Listener.Wsdl",
"ListenerSoap"), ListenerSoap.class);
}
}
而在使用上面的代碼示例DataStore作爲二進制對象(儘管如何上傳它們對我來說仍然是一個小小的模糊)。
我們該如何設置此Web服務使用雙向SSL進行身份驗證所需的必要值?
感謝所有幫助
更新:
通過我已經看到了這個研究是如何能在傳統的服務器上完成(一個與文件系統訪問):
ListenerSoap soap = new Listener().getListenerSoap();
((BindingProvider) soap).getRequestContext().put("javax.net.ssl.keyStore", "client_cert.p12"
但是,在這種方法中,client_cert.p12
預計在文件系統上。
此外,SSLSocketFactory
,SSLContext
,KeyManager
和KeyManagerFactory
都不允許在GAE上。
更新:
由於GAE SDK版本1.7.7。現在應該是可能的:
Similarly, Java developers can now use the javax.net.ssl package to make outbound SSL connections.
在URLFetch服務中有一個支持客戶端證書的開放功能請求:http://code.google.com/p/googleappengine/issues/detail?id=3719 –