aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorJacob Schooley <jacob.schooley@gmail.com>2023-07-18 23:45:42 -0400
committerJacob Schooley <jacob.schooley@gmail.com>2023-07-18 23:45:42 -0400
commit548b19193febdd7e53e4e42014ad46235866de58 (patch)
treecb96c85def68cfb704658d39504028737b67f6aa /src/main/java/org
parent3642b952086355f5f2a52f7dc9b2cdfea4c02e31 (diff)
downloadtrackermap-server-548b19193febdd7e53e4e42014ad46235866de58.tar.gz
trackermap-server-548b19193febdd7e53e4e42014ad46235866de58.tar.bz2
trackermap-server-548b19193febdd7e53e4e42014ad46235866de58.zip
Set session cookie max age if web.sessionTimeout is set
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/web/WebServer.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java
index b5d2f2771..184c546d5 100644
--- a/src/main/java/org/traccar/web/WebServer.java
+++ b/src/main/java/org/traccar/web/WebServer.java
@@ -193,14 +193,16 @@ public class WebServer implements LifecycleObject {
sessionHandler.setSessionCache(sessionCache);
}
+ SessionCookieConfig sessionCookieConfig = servletHandler.getServletContext().getSessionCookieConfig();
+
int sessionTimeout = config.getInteger(Keys.WEB_SESSION_TIMEOUT);
if (sessionTimeout > 0) {
servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout);
+ sessionCookieConfig.setMaxAge(sessionTimeout);
}
String sameSiteCookie = config.getString(Keys.WEB_SAME_SITE_COOKIE);
if (sameSiteCookie != null) {
- SessionCookieConfig sessionCookieConfig = servletHandler.getServletContext().getSessionCookieConfig();
switch (sameSiteCookie.toLowerCase()) {
case "lax":
sessionCookieConfig.setComment(HttpCookie.SAME_SITE_LAX_COMMENT);