1
votes

I am working on a grails project that leverages the apache shiro plugin. I would like to override the default session timeout. What would be the best way to do this? I read somewhere that you can set :

securityManager.sessionManager.globalSessionTimeout

Where do I set this? In the Config.groovy file?

Thanks in advance for your help.

1
I found a solution : SecurityUtils.subject.getSession().setTimeout()mcroteau

1 Answers

3
votes

Your solution works per-session, but it makes more sense to override it once in web.xml rather than overriding the default for every session. To do that, run grails install-templates and edit src/templates/war/web.xml. There's probably already a session-config element there, but if not you can add one:

<session-config>
   <session-timeout>120</session-timeout>
</session-config>

To avoid upgrade issues, delete the other template files if you don't plan on changing those. You can always re-run install-templates since it will detect existing files and ask you whether to overwrite.