Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin 7 session timeout
I need to implement session timeout within my application but this is proving much harder than it should be in Vaadin 7 - I see many discussions on the topic but no clear solution.
Specify session timeout in web.xml and have HTTP sessions invalidated after this timeout period has passed with no user activity.
Vaadin configured as follows:
- Push NOT enabled
- Session timeout set to 1 minute
- Heartbeat set to 5 seconds
- closeIdleSessions set to true
<servlet-name>Vaadin Application Servlet</servlet-name>
<description>Vaadin UI to display</description>
What I observe with this setup:-
After 1 minute of no user activity, the Vaadin Session Expired notification pops up. That is great, that is what I want. However, the HTTP session is not invalidated until another minute (session timeout) has passed AFTER that notification. So although the user is notified their session has expired, the HTTP session is not invalidated until another minute has passed. That is bad, as the session, including authentication information etc. remains active.
Its almost like the heartbeat requests are keeping the HTTP session alive. Its only after they stop coming (after the first minute when Vaadin says the session is expired) that the HTTP session appears to begin the timeout period. This is bad because although the user has received a session timeout message, there is still an active HTTP session. I thought the closeIdleSessions parameter should prevent heartbeat requests being counted towards the HTTP session being kept alive?
I know theres a few workarounds by setting system messages etc., but they all feel wrong.
Am I missing something here?
Thanks in advance.