Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed session length : logout user after N hours, even with activity #5753

Open
zedtux opened this issue Jan 8, 2025 · 0 comments
Open

Fixed session length : logout user after N hours, even with activity #5753

zedtux opened this issue Jan 8, 2025 · 0 comments

Comments

@zedtux
Copy link
Contributor

zedtux commented Jan 8, 2025

This gem is able to logout a user after a period of inactivity that is configured with the config.timeout_in parameter.

In some applications it is required to logout a user after a fixed length of time, for security reason, no matter the user is active or not, which is not supported by this gem as far as I can see.

The Timeoutable class could be extended with a new optional parameter (similar to the timeout_in one) or by changing the behavior of the timeout_in parameter:

  • when it is an Integer or a String, it keeps the current behavior
  • when it is a Hash:
    • the inactivity key configures the inactivity timeout
    • the max key (or max_duration if better?) configures the new feature, login out the user when the session length is greater

Not sure about the name, I'm not good at naming things, sorry.

Of course, like the timeout_in works today, when this new parameter, or the max key is not set or nil, the feature is disabled.

A new warden session column would save the login time, which would be used to mesure the current session length and logout the user when its session length is greater than the given one.

In my eyes that look quite easy to test, and to implement since it is quite similar to the existing timeout feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant