![](/img/trans.png)
[英]How to turn off authentication for websockets in Spring Security?
[英]How to turn off HTTP session timeout in Spring Security?
可以在Spring Security中关闭HTTP会话超时吗?
从这个答案中,我看到可以在web.xml中修改HTTP会话超时,如下所示:
<session-config>
<session-timeout>10</session-timeout>
</session-config>
但是我从Spring Security手册中找不到如何禁用超时。
从这个答案中,我看到Spring Security在内部使用了javax.servlet.http.HttpSession,根据本手册页,可以通过调用setMaxInactiveInterval(0)将其设置为永不过期。
因此,它应该可以通过获得HttpSession中(如图所示改变会话超时这里在回答中),并改变maxInactiveInterval为0。我的问题是,如果我将做到这一点的第一次用户登录后,会在更改持续存在于HttpSession中(即在下一个请求中,HttpSession中的更改是否仍将存在?)
是否可以像这样禁用web.xml中的会话超时?
<session-config>
<session-timeout>0</session-timeout>
</session-config>
还有一个问题,Spring Security中的默认HTTP会话超时是多少?
是的。除非会话显式无效,否则以下代码段将使HTTPSession保持活动状态
<session-config>
<session-timeout>0</session-timeout>
</session-config>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.