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

Session Timeout Hook #39

Closed
mhaseebkhan opened this issue Jan 18, 2012 · 3 comments
Closed

Session Timeout Hook #39

mhaseebkhan opened this issue Jan 18, 2012 · 3 comments

Comments

@mhaseebkhan
Copy link

I am working on a Sinatra App in which I am using Warden for managing authentication. Please note that I am not using Devise at all. I am in need of a Session Timeout Hook which gets called when session expires as I need to clear-up certain things and do some custom operations.

I also would like to mention that I am using Rack::Session::Dalli as well.

Any ideas how to achieve it?

@josevalim
Copy link
Contributor

Warden does not implement session timeout on its own. So there isn't a hook. So what is expiring the session? Or do you want to implement session timeout?

@mhaseebkhan
Copy link
Author

I want to implement session timeout.

Thoughts?

@josevalim
Copy link
Contributor

Devise implements it by storing and checking the last time a request happend in Warden.after_set_user hook. If it happens that the user last request happened more than a specified time, you call throw :warden from the hook.

https://github.com/plataformatec/devise/blob/master/lib/devise/hooks/timeoutable.rb

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

No branches or pull requests

2 participants