Automatic Inactivity Detection possibilities

I have a perspective project where authentication is not required. Security is setup on the tags so only certain users can write to tags, but all users can view tags. I would like to use the automatic inactivity detection (or property change script on the perspective session property lastActivity) to automatically logout an authenticated user after a set time period and redirect to a view using an unauthenticated user. Is this possible? Currently, after the automatic logout, it redirects to a page that states the user has been logged out of the session.

You can set up a script using the lastActivity session prop (I'd probably use a property bound to the current date, updating once per minute, with a change script like in this post) and then call the system.security.switchUser() function to switch to some "guest" user, since it seems like the logout function takes you to the login page again.

You could probably also have a script that automatically logs the user in to the "guest" user on session start, and hijack the logout button to switch user to your "guest" instead. never mind, can't do that in Perspective

Maybe someone else has a less complicated solution solution that actually works though.

system.security.switchUser only works in Vision unfortunately.

1 Like

Oh yeah, I didn't notice that. Well there goes that idea out the window.

Maybe if you can have your IdP autologin to a "guest" account, this could still work, just with the regular logout feature?
[FEATURE-1402] Perspective “autologin” IdP

I guess that would still show the "logged out" screen.