From 7b335bcc74af1919347e5db4c444588e1b595d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Thu, 9 Nov 2023 10:04:39 +0100 Subject: [PATCH] feature/Add props session_inactivity_timeout_in_minutes --- src/main/resources/props/sample.props.template | 5 +++++ src/main/scala/bootstrap/liftweb/Boot.scala | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/resources/props/sample.props.template b/src/main/resources/props/sample.props.template index 204faca7..36387c7a 100644 --- a/src/main/resources/props/sample.props.template +++ b/src/main/resources/props/sample.props.template @@ -179,5 +179,10 @@ dev.port=8082 # ------------------------------ Identity Provider OAuth2 Props end -------------------------- +# If you want to make the Lift inactivity timeout shorter than +# the container inactivity timeout, set the inactivity timeout here +session_inactivity_timeout_in_minutes = 30 + + # Please note that depricated name ot this props is: language_tag default_locale = en_GB \ No newline at end of file diff --git a/src/main/scala/bootstrap/liftweb/Boot.scala b/src/main/scala/bootstrap/liftweb/Boot.scala index 59c72a3e..2033c34d 100755 --- a/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/src/main/scala/bootstrap/liftweb/Boot.scala @@ -240,5 +240,12 @@ class Boot extends MdcLoggable{ // Used in order to allow to override the Host header where using java's HttpUrlConnection class System.setProperty("sun.net.http.allowRestrictedHeaders", "true") + Props.get("session_inactivity_timeout_in_minutes") match { + case Full(x) if tryo(x.toLong).isDefined => + LiftRules.sessionInactivityTimeout.default.set(Full((x.toLong.minutes): Long)) + case _ => + // Do not change default value + } + } }