Foros de discusión

Dynamically setting session timeout

Christopher Jazinski, modificado hace 7 años.

Dynamically setting session timeout

New Member Mensajes: 8 Fecha de incorporación: 17/10/16 Mensajes recientes
Good morning, day or evening Liferay community members. I had a question that I can't seem to find the answer to so thought I would run it by you guys. I am interested in dynamically changing the session timeout value for the logged in user based on some criteria - Perhaps user type, user location, etc. I've found documentation that describes how to set this in portal.properties and web.xml at the servlet level. Could I perhaps have a portlet that manipulates the HttpSession object - specifically the setMaxInactiveInterval method just "running" in the background that manipulates the time-out. Has anyone done this before? Thanks.
thumbnail
Olaf Kock, modificado hace 7 años.

RE: Dynamically setting session timeout

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
Christopher Jazinski:
I am interested in dynamically changing the session timeout value for the logged in user based on some criteria


As session handling is typically a function of your appserver/servlet container, it depends on which one you're using. I'm not aware of any that allows access to this setting easily and dynamically. But that's largely a function of never having looked for this feature.

What you could always do is to set the session to be short and run some javascript code that automatically extends the session until your desired session time is reached. This would be largely similar to what Liferay does anyway (but unlimited) if you set session.timeout.auto.extend=true in portal-ext.properties. Of course, this feature would break on a closed browser window, as no javascript would be running then, but this might be desired behaviour.