我在一个网站中已经配置好了ssl,但有的用户没有将U盾插入电脑,直接访问系统在IE中是显示无法显示该网页;在chrome中是显示错误 117 (net::ERR_BAD_SSL_CLIENT_AUTH_CERT):未知错误。
我在web.xml中配置:
<error-page>
<error-code>404</error-code>
<location>/404.htm</location>
</error-page>
<error-page>
<error-code>117</error-code>
<location>/117.htm</location>
</error-page>
404的错误出现后会自动调整到404.htm页面,当117无法自动调整到117.htm页面,这两个页面大小都超过1K。请问如果用户在没有使用U盾(数字证书在其中),访问系统时,如果显示友好一点的提示,比如请将U盾插入到电脑?
我在web.xml中配置:
<error-page>
<error-code>404</error-code>
<location>/404.htm</location>
</error-page>
<error-page>
<error-code>117</error-code>
<location>/117.htm</location>
</error-page>
404的错误出现后会自动调整到404.htm页面,当117无法自动调整到117.htm页面,这两个页面大小都超过1K。请问如果用户在没有使用U盾(数字证书在其中),访问系统时,如果显示友好一点的提示,比如请将U盾插入到电脑?
403.4 禁止访问:需要使用 SSL 查看该资源。
403.5 禁止访问:需要使用 SSL 128 查看该资源。
403.7 禁止访问:需要 SSL 客户端证书。
403.12 禁止访问:服务器证书映射器拒绝了客户端证书访问。
403.13 禁止访问:客户端证书已在 Web 服务器上吊销。
403.15 禁止访问:Web 服务器已超过客户端访问许可证限制。
403.16 禁止访问:客户端证书格式错误或未被 Web 服务器信任。
403.17 禁止访问:客户端证书已经到期或者尚未生效。
我对web.xml也进行了如下配置:
<error-page>
<error-code>403.4</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.5</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.7</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.12</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.13</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.15</error-code>
<location>/117.htm</location>
</error-page>
<error-page>
<error-code>403.16</error-code>
<location>/117.htm</location>
</error-page>
但还是没有跳转到我指定的显示页面
<security-constraint>
<web-resource-collection>
<web-resource-name>SSL</web-resource-name>
<url-pattern>/jsp/common/login.jsp</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
现在把security-constraint去掉,将filter设为/*就行了,唯一的缺点就是网站不能由80自动调转到8443了。X509Certificate certChain[] = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");// 证书是否存在
if (certChain == null) {
res.sendRedirect(req.getContextPath()+ Contants.PAGE_ERROR_NOCERT);
return;
}
try {
certChain[0].checkValidity();
} catch (CertificateExpiredException e) {
// TODO Auto-generated catch block
//证书已过期
e.printStackTrace();
} catch (CertificateNotYetValidException e) {
// TODO Auto-generated catch block
//证书未生效
e.printStackTrace();
}
// 证书被注销
if (crl.isRevoked(certChain[0])) {
res.sendRedirect(req.getContextPath()+ Contants.PAGE_ERROR_CERTREVOKED);
return;
}