Java Tomcat身份验证要求重新登录,即使浏览器尚未关闭
我在Tomcat下运行的web应用程序中使用摘要身份验证。 我注意到,每隔一段时间它就会要求我重新登录:要求我输入用户名和密码的弹出窗口就会再次出现。 如何防止这种行为?我只想在第一次打开网站时登录 我注意到,在web浏览器上进行多次刷新后,会发生这种情况。如果没有刷新,那么它将不会再次要求我输入用户名和密码。我认为只要我不关闭浏览器,默认行为就不会再次要求我进行身份验证。我的理解正确吗 我不确定这是否有帮助,但我尝试在web.xml文件中将会话超时设置为-1,但似乎没有帮助Java Tomcat身份验证要求重新登录,即使浏览器尚未关闭,java,apache,jsp,tomcat,Java,Apache,Jsp,Tomcat,我在Tomcat下运行的web应用程序中使用摘要身份验证。 我注意到,每隔一段时间它就会要求我重新登录:要求我输入用户名和密码的弹出窗口就会再次出现。 如何防止这种行为?我只想在第一次打开网站时登录 我注意到,在web浏览器上进行多次刷新后,会发生这种情况。如果没有刷新,那么它将不会再次要求我输入用户名和密码。我认为只要我不关闭浏览器,默认行为就不会再次要求我进行身份验证。我的理解正确吗 我不确定这是否有帮助,但我尝试在web.xml文件中将会话超时设置为-1,但似乎没有帮助 <sessi
<session-config>
<session-timeout>-1</session-timeout>
</session-config>
-1
以下是完整的web.xml文件:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<resource-env-ref>
<description>user db</description>
<resource-env-ref-name>UserDatabase</resource-env-ref-name>
<resource-env-ref-type>org.apache.catalina.UserDatabase</resource-env-ref-type>
</resource-env-ref>
<security-constraint>
<web-resource-collection>
<web-resource-name>user-resource</web-resource-name>
<description>pages which require login</description>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.html</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description>Must authenticate before querying the system</description>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>DIGEST</auth-method>
</login-config>
<session-config>
<session-timeout>-1</session-timeout>
</session-config>
</web-app>
用户数据库
用户数据库
org.apache.catalina.UserDatabase
用户资源
需要登录的页面
*.jsp
*.html
得到
邮递
必须在查询系统之前进行身份验证
管理
没有一个
消化
-1
服务器是否已重新启动?这可以清除会话数据,这取决于您的服务器配置。是的,您需要在web.xml更改后重新启动我重新启动了,但我仍然有相同的问题。我假设您在web.xml中定义了安全约束-您可以发布完整的web.xml吗?我刚刚在发布中添加了web.xml