【发布时间】:2017-01-05 11:20:09
【问题描述】:
我有什么:
- 是带有 EJB Web 服务的传统 9.0;
- webservice 客户端 - java 应用程序;
- SSL 仅配置为 9449 端口,如此处所述(一种方式 http://www.ibm.com/developerworks/webservices/tutorials/ws-radsecurity3/ws-radsecurity3.html)
我需要 SSL 相互身份验证,因此我转到保护质量 (QoP) 设置,并设置客户端身份验证 = 必需。 到目前为止一切正常。
问题是我的 EJB 应用程序需要客户端证书的公用名来获取用户 ID,它将在业务逻辑中使用。在这里我失败了。 代码sn-p(web服务端):
MessageContext context = wsContext.getMessageContext();
HttpServletRequest req = (HttpServletRequest)context.get(MessageContext.SERVLET_REQUEST) ;
System.out.println("!! isSecure " + req.isSecure());
X509Certificate[] certificates = (X509Certificate[]) req.getAttribute("java.servlet.request.X509Certificate");
if (null != certificates && certificates.length > 0) {
...
} else {
System.out.println("!! Empty certificates");
}
isSecure 返回 true,但我收到“空证书”消息。
我的猜测可能是以下原因。当我输出 9449 端口上使用的 SSL 配置时,第一行是“com.ibm.ssl.clientAuthenticationSupported = false”,而通过管理控制台将其设置为必需。
com.ibm.websphere.ssl.JSSEHelper jsseHelper = com.ibm.websphere.ssl.JSSEHelper.getInstance();
java.util.Properties props = jsseHelper.getProperties("WebServiceConfigure");
System.out.println("!!! WebServiceConfigure = " + props.toString());
【问题讨论】:
-
您是否有单元设置(DMGR 和节点)或独立服务器?对于单元,您需要确保在创建服务器的相应节点上设置 QoP 设置。如果在 DMGR 上设置,这些设置将不适用于其他服务器。
-
我正在独立测试它,但它会转移到 DMGR。我会记住您的建议,谢谢。
标签: web-services authentication https client websphere