【问题标题】:Tomcat Security Constraint not workingTomcat 安全约束不起作用
【发布时间】:2013-02-25 00:39:19
【问题描述】:

添加对tomcat的https支持后。我无法运行应用程序

我的 web.xml 配置

<display-name>EBaySignin</display-name>
<welcome-file-list>
    <welcome-file>credentials.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>All Access</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

(Tomcat)server.xml 配置:

  <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->

    <Connector port="8443"  SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
        keystoreFile="/Users/ArunAbraham/.keystore" keystorePass="password"
        protocol="org.apache.coyote.http11.Http11NioProtocol" 
               clientAuth="false" sslProtocol="TLS" />

现在我无法访问该应用程序,我收到一个错误:无法连接到服务器。我会错过什么? ("https://localhost:8443/EBaySignin/")

【问题讨论】:

    标签: java jsp tomcat web-applications


    【解决方案1】:

    有几件事可能是错误的。 还要更具体地了解错误并检查服务器日志。 可能的问题:

    1. 检查密钥库文件的路径、密码和内容。 它需要一个通过匹配主机名来标识服务器的 SSL 条目。
    2. 最初删除“web.xml”安全约束。 首先让 SSL 在端口 8443 上工作,然后在 SSL 工作后重新添加。
    3. 确保客户端可以通过网络的 8443 端口访问服务器。
    4. 返回 Tomcat SSL 设置中的每个点。 我已经用过很多次了,而且效果很好。 http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

    【讨论】:

    • 我确实在没有 声明的情况下进行了检查,SSL 工作正常。但是,一旦我添加了 声明,所有应用程序都不起作用。即使是非安全的也不起作用。它只是给出 http 404 错误。
    • 我可以访问这个localhost:8443,但我无法访问网络应用程序,我得到服务器未找到错误 (404)。
    • 好的,所以 SSL 不是问题。所以现在到安全​​约束。再次,检查有关如何实现的基本文档,但检查“web.xml”中条件的 URL 模式,如果使用例如基于角色的安全性,则安全角色名称与设置的内容匹配在接收方。请记住, 元素会阻止未经授权的用户进入应用程序,因此他们必须获得授权(用户/密码)、他们的角色、检查等。
    猜你喜欢
    • 2020-11-04
    • 2014-11-20
    • 1970-01-01
    • 2014-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-08
    相关资源
    最近更新 更多