Mike Croteau
Mike Croteau

Reputation: 1132

Grails + Apache Shiro plugin - Setting session timeout

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.

Upvotes: 1

Views: 582

Answers (1)

Burt Beckwith
Burt Beckwith

Reputation: 75671

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.

Upvotes: 3

Related Questions