diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2023-07-18 21:11:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 21:11:38 -0700 |
commit | a632bdab0f5a6771ae40260a485c93bdcc853d42 (patch) | |
tree | cb96c85def68cfb704658d39504028737b67f6aa | |
parent | 3642b952086355f5f2a52f7dc9b2cdfea4c02e31 (diff) | |
parent | 548b19193febdd7e53e4e42014ad46235866de58 (diff) | |
download | trackermap-server-a632bdab0f5a6771ae40260a485c93bdcc853d42.tar.gz trackermap-server-a632bdab0f5a6771ae40260a485c93bdcc853d42.tar.bz2 trackermap-server-a632bdab0f5a6771ae40260a485c93bdcc853d42.zip |
Merge pull request #5139 from jbschooley/cookie-fix
Set session cookie max age if web.sessionTimeout is set
-rw-r--r-- | src/main/java/org/traccar/web/WebServer.java | 4 |
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); |