Skip to content
Snippets Groups Projects
Commit 171b5d6d authored by srosse's avatar srosse
Browse files

OO-3585: set session cookie as secure (only if https available)

parent 55058f7b
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ var timestampLastPoll = new Date().getTime(); ...@@ -30,7 +30,7 @@ var timestampLastPoll = new Date().getTime();
// set timestamp cookie to inform other windows that they are outdated // set timestamp cookie to inform other windows that they are outdated
var sbtimestamp = new Date().getTime(); var sbtimestamp = new Date().getTime();
var sbcookie = 'OLAT-UI-TIMESTAMP'; var sbcookie = 'OLAT-UI-TIMESTAMP';
if (window.opener == null) document.cookie = sbcookie+'='+sbtimestamp+'; path=/'; if (window.opener == null) document.cookie = sbcookie+'='+sbtimestamp+'; path=/; SameSite=strict';
## starts an interval which checks every second whether to send an poll request based on ## starts an interval which checks every second whether to send an poll request based on
## the pollperiod or not 10 min after the last click the poll process stops ## the pollperiod or not 10 min after the last click the poll process stops
......
...@@ -26,6 +26,7 @@ import java.util.Map; ...@@ -26,6 +26,7 @@ import java.util.Map;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.SessionCookieConfig;
import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -124,6 +125,12 @@ public class OpenOLATServlet extends HttpServlet { ...@@ -124,6 +125,12 @@ public class OpenOLATServlet extends HttpServlet {
} }
} }
if(Settings.isSecurePortAvailable()) {
SessionCookieConfig cookieConfig = servletConfig.getServletContext().getSessionCookieConfig();
cookieConfig.setSecure(true);
cookieConfig.setHttpOnly(true);
}
//preload extensions //preload extensions
ExtManager.getInstance().getExtensions(); ExtManager.getInstance().getExtensions();
AbstractSpringModule.printStats(); AbstractSpringModule.printStats();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment