Authentication 通过web.xml中的安全约束(localhost除外)进行身份验证

Authentication 通过web.xml中的安全约束(localhost除外)进行身份验证,authentication,glassfish,localhost,web.xml,security-constraint,Authentication,Glassfish,Localhost,Web.xml,Security Constraint,在JavaEEservlet容器(Tomcat、Glassfish等)的web.xml中,我可以设置一个安全约束来限制对特定资源的访问 是否可以区分从本地主机和所有其他主机的访问?我想在glassfish服务器中为所有对webapp的外部调用启用身份验证,但不是从localhost。这可能吗?将其放入您的/META-INF/context.xml: <Context> <Valve className="org.apache.catalina.valves.Remote

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


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

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

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