【问题标题】:authentication via the security-constraint in the web.xml except for localhost通过 web.xml 中的安全约束进行身份验证,localhost 除外
【发布时间】:2012-10-25 14:30:54
【问题描述】:

在 Java EE Servlet 容器(Tomcat、Glassfish 等)的 web.xml 中,我可以设置安全约束来限制对特定资源的访问。

是否可以区分来自 localhost 的访问和所有其他访问?我想在 glassfish 服务器中为对 webapp 的所有外部调用启用身份验证,但不是从 localhost。这可能吗?

【问题讨论】:

    标签: authentication glassfish localhost web.xml security-constraint


    【解决方案1】:

    把这个放在你的/META-INF/context.xml:

    <Context>
        <Valve className="org.apache.catalina.valves.RemoteAddrValve" deny="127\.0\.0\.1"/>
    </Context>
    

    【讨论】:

      猜你喜欢
      • 2012-02-08
      • 2014-02-19
      • 1970-01-01
      • 2012-01-18
      • 2011-04-10
      • 2016-11-01
      • 2013-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多