Concerning cookies expiration time what is the best practice for a secure application ?
The login system is a SSO that I can't manage, so the ["remember me"][1]
option is not possible.
There are 2 solutions
- Time expiration, the cookie would expire after a specific amount of time, i.e. 4 hours. But if the user use a shared computer and forgot to log out, another user could access the web application.
- Session expiration, the cookie would expire after the web browser is closed (or
[even worse][2]
. But what if the user never close his session and always keep is computer turned on. The cookie would never expire even if the user doesn't need access to the web application.
Is there not a way to do both at the same time? Base the cookie expiration on the session with a maximum duration of time...
NB : Believing in a security aware user is a sweet dream, thus trust in the user log out is not feasible.
. [1]: What is an acceptable expiration time for a cookie [2]: When does a cookie with expiration time 'At end of session' expire?