Persistent session (e.g. with cookies) [message #1858280] |
Sun, 26 March 2023 15:22  |
Eclipse User |
|
|
|
Hello,
I have a small Scout application with a simple Form based authentication (it uses the standard Scout login form).
There is a class implementing ICredentialVerifier to validate the user and password.
I would like to have persistent sessions, that is, if the user closes his browser without logout, and then reopens the application URL later, a cookie is kept (on the browser) and is used by the application to retrieve the principal and allow access from the same browser without a new authentication.
How can I achieve this with the Scout framework ?
Thank you
Michel
|
|
|
|
|
Re: Persistent session (e.g. with cookies) [message #1858308 is a reply to message #1858305] |
Tue, 28 March 2023 04:24   |
Eclipse User |
|
|
|
The state of the ClientSession is stored in the ui server and attached to the HttpSession. If the HttpSession times out, your webserver will remove it including all attached objects. So no, you cannot restore the ClientSession after a session timeout.
However, you could make sure the session does not expire that fast. If a user is active (creating requests by using the UI), the webserver will automatically increase the lifetime of the session. If the user is inactive but has the browser open, the background poller of Scout will keep the session alive, but only as long as specified by scout.ui.maxUserIdleTime (docs). So, you could increase that value. If the user closes the browser, the regular session timeout of your webserver (see web.xml) will come into place. You could increase this value as well, but keep in mind that the ClientSession uses quite a bit of memory. So I recommend to keep this value low to make sure the webserver can relase unused memory and won't go out of memory if many users connect.
[Updated on: Wed, 29 March 2023 06:20] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03291 seconds