Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Web 服务器 (apache) 中实现了强身份验证,效果很好。但我想实现一个 java 类,该类必须将 cac ID 和 suject 名称与 java .properties 文件或 XML 上的名称进行比较
不确定您的部署,但例如,如果您需要从部署的 servlet 中执行此操作,Tomcat您可以执行以下操作:
Tomcat
X509Certificate[] certs = (X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
如果客户已发送证书,那么certs将拥有它们,您可以进行所需的检查,并可能根据您的需要拒绝。 请注意,这将在SSL 握手完成后发生。
certs