我有一個Web應用程序,我想與客戶端證書一起使用。我在web.xml中設置了以下內容,並且可以通過https訪問我的應用程序。Glasfish 2.1 CLIENT-CERT如何獲得本金
<security-constraint>
<web-resource-collection>
<web-resource-name>securedapp</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>CLIENT-CERT</auth-method>
</login-config>
握手工作正常。我只使用該證書作爲糧食安全措施。我只是想知道提供的證書的主體,因此不需要登錄。但是,當我嘗試從會話中獲得主體時,它是空的。
我也曾嘗試
X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");
但這也爲NULL。有誰知道我如何從我的證書中獲得校長?
非常感謝 Noush