【问题标题】:Override security constraint in Jetty 9覆盖 Jetty 9 中的安全约束
【发布时间】:2017-06-02 22:22:36
【问题描述】:

我们正在使用设置为机密的安全约束策略强制从 http 重定向到 https。尽管在本地开发中,我们希望消除约束。在 Jetty 7 中,我们使用 override-web.xml 将传输安全性从 CONFIDENTIAL 重新分配为 NONE。现在,在我们迁移到 Jetty 9 之后,它突然停止了迁移。我怀疑现在使用 Jetty 9 而不是覆盖传输安全性,它会向列表添加约束。

如何在本地环境中将安全约束从 CONFIDENTIAL 覆盖为 NONE?

这是来自web.xml的部分:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Some server</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

在本地开发中,我们使用 jetty-maven-plugin 运行码头并指定 override-web.xml。这是来自override-web.xml的部分:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Some server</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

Jetty 之前的版本:7.6.10.v20130312
之后的码头版本:9.2.18.v20160721

【问题讨论】:

    标签: jetty servlet-3.0 maven-jetty-plugin


    【解决方案1】:

    此功能应该在 Jetty 9 中工作,就像在 Jetty 7 中一样。

    您可以从here找到WebApp configuration的说明

    他们在Jetty 9 中更改了一些标签,因此在阅读配置时要格外小心。你的pom.xml 中应该有这样的内容:

    <configuration>
    <webApp>
    <overrideDescriptor>{path_to_your_override_xml}</overrideDescriptor>
    </webApp>
    </configuration>
    

    例如标签

    <webApp> </webApp>
    

    更早

    <webAppConfig> </webAppConfig>
    

    按照Jetty startup log 并验证您的覆盖是否已应用:

    [INFO] Web overrides = {path_to_your_override_xml}
    

    【讨论】:

      猜你喜欢
      • 2012-11-23
      • 1970-01-01
      • 2013-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      相关资源
      最近更新 更多