Logout a user when his session expires

In all my previous projects, I did enjoy that the frontend users were staying logged in indefinitely on the webapp.
But In my current project, I need to logout them out when their session expires.
the plugin rainlab.user does not seem to handle that by default or I missed something.

How could we achieve this frontend user auto-logout ?

You could create a scheduler task that logs the user out if they are expired.

You would just need to figure out how to get the user’s session in that task.