通过web.xml中的security-constraint进行身份验证,但localhost除外

时间:2012-10-25 14:30:54

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

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

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

1 个答案:

答案 0 :(得分:0)

将其放入/META-INF/context.xml

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