Ring middleware for session timeouts