【问题标题】:setting session timeout in Grails Spring Security Core Plugin在 Grails Spring Security Core Plugin 中设置会话超时
【发布时间】:2012-07-26 08:03:33
【问题描述】:

尽管搜索了插件文档和一般搜索,但我找不到这个问题的答案。我得到的最接近的是 this 页面的结尾,它似乎描述了设置 Tomcat 超时。插件文档有一整节标题为“Config.groovy 中的配置设置”,有没有办法在不涉及容器设置的情况下为插件配置超时?

【问题讨论】:

    标签: grails spring-security


    【解决方案1】:

    插件没有会话持续时间的设置 - 它只是使用为整个应用程序配置的任何内容。您可以通过编辑 web.xml(如果您还没有运行 grails install-templates)并编辑 src/templates/war/web.xml 来做到这一点。添加

    <session-config>
       <session-timeout>30</session-timeout>
    </session-config>
    

    welcome-file-list 元素之前并将session-timeout 值设置为您希望的任何分钟数。

    【讨论】:

    • 这种方法是否适用于非 Tomcat 容器?我对 Grails 应用程序一旦启动后会发生什么知之甚少。
    • 是的,web.xml 文件被所有容器读取,因为它是 servlet 规范的一部分。容器通常还具有容器特定的描述符,例如jboss-web.xml,但这些是 web.xml 的补充
    • @BurtBeckwith 我认为 Grails 包含 web.xml? install-templates 需要吗?
    • 如果您不运行install-templates,Grails 将使用默认模板,该模板是已安装 Grails 发行版的一部分。当您运行 install-templates 时,它们会被复制到您的应用程序中,并且会被使用。
    • 查看此链接了解如何为 grails 3 应用程序设置会话超时nimavat.me/code-snippets/grails3-session-timeout
    猜你喜欢
    • 2012-05-18
    • 2015-12-02
    • 2016-08-16
    • 2012-12-26
    • 2021-02-06
    • 2011-07-20
    • 2018-09-27
    • 2016-08-03
    相关资源
    最近更新 更多