Groovy and spring security configurable logout time

107 views Asked by At

I want to have a property in my domain class for a certain user which could be use to configure the logout time. Is this possible with springSecurity?

I've searched for online example but haven't found anything

1

There are 1 answers

1
ataylor On BEST ANSWER

The login credentials are stored in the user's session. You can set the maximum amount of inactive time per user with something like this after the user has logged in:

session.maxInactiveInterval = user.maxInactiveInterval

If you want to set the logout time independent of the user's activity, just schedule a timer or job and call session.invalidate() at the appropriate time. Note that this might cut off a user in the middle of a task.

If you're using "remember me" authentication, see the Spring Security docs for setting the expiry time.