【问题标题】:Websphere App Server mutual SSL - obtain CN from client certificate authenticationWebsphere App Server 双向 SSL - 从客户端证书认证获取 CN
【发布时间】:2017-01-05 11:20:09
【问题描述】:

我有什么:

我需要 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


【解决方案1】:

您可能想尝试“直接连接”证书属性。创建它是为了解决颁发与最终客户端不同的证书的中间(SSL 终止)代理(如带有插件的 Web 服务器)。这个属性是

com.ibm.websphere.ssl.direct_connection_peer_certificates

您可以通过com.ibm.websphere.webcontainer.is_direct_connection 确定您是从直接连接对等方还是代理对等方获取证书。

另请参阅:WAS 9 doc page

【讨论】:

  • 谢谢你,pglezen! certificate[0].getSubjectDN().getName() 返回我 CN=xxx, C=YY
猜你喜欢
  • 2013-08-04
  • 2019-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-06
  • 2017-04-19
  • 1970-01-01
  • 2010-10-16
相关资源
最近更新 更多