diff --git a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs index ad0cf5e0..cbaa7063 100644 --- a/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs +++ b/SafeExamBrowser.Browser.UnitTests/Handlers/RequestHandlerTests.cs @@ -48,7 +48,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers settings = new BrowserSettings(); windowSettings = new WindowSettings(); text = new Mock(); - resourceHandler = new ResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, settings, windowSettings, text.Object); + resourceHandler = new ResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, default, settings, windowSettings, text.Object); sut = new TestableRequestHandler(appConfig, filter.Object, logger.Object, resourceHandler, settings, windowSettings); } diff --git a/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs b/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs index 822e883c..398fb95c 100644 --- a/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs +++ b/SafeExamBrowser.Browser.UnitTests/Handlers/ResourceHandlerTests.cs @@ -18,6 +18,7 @@ using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; +using SafeExamBrowser.Settings; using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter; using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings; @@ -49,7 +50,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers windowSettings = new WindowSettings(); text = new Mock(); - sut = new TestableResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, settings, windowSettings, text.Object); + sut = new TestableResourceHandler(appConfig, filter.Object, keyGenerator.Object, logger.Object, SessionMode.Server, settings, windowSettings, text.Object); } [TestMethod] @@ -298,9 +299,10 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers IRequestFilter filter, IKeyGenerator keyGenerator, ILogger logger, + SessionMode sessionMode, BrowserSettings settings, WindowSettings windowSettings, - IText text) : base(appConfig, filter, keyGenerator, logger, settings, windowSettings, text) + IText text) : base(appConfig, filter, keyGenerator, logger, sessionMode, settings, windowSettings, text) { } diff --git a/SafeExamBrowser.Browser/BrowserApplication.cs b/SafeExamBrowser.Browser/BrowserApplication.cs index b3eedefc..23afc8f9 100644 --- a/SafeExamBrowser.Browser/BrowserApplication.cs +++ b/SafeExamBrowser.Browser/BrowserApplication.cs @@ -24,6 +24,7 @@ using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.Core.Contracts.Resources.Icons; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; +using SafeExamBrowser.Settings; using SafeExamBrowser.Settings.Browser.Proxy; using SafeExamBrowser.Settings.Logging; using SafeExamBrowser.UserInterface.Contracts; @@ -45,6 +46,7 @@ namespace SafeExamBrowser.Browser private readonly IModuleLogger logger; private readonly IMessageBox messageBox; private readonly INativeMethods nativeMethods; + private readonly SessionMode sessionMode; private readonly BrowserSettings settings; private readonly IText text; private readonly IUserInterfaceFactory uiFactory; @@ -68,9 +70,10 @@ namespace SafeExamBrowser.Browser IFileSystemDialog fileSystemDialog, IHashAlgorithm hashAlgorithm, IKeyGenerator keyGenerator, - INativeMethods nativeMethods, IMessageBox messageBox, IModuleLogger logger, + INativeMethods nativeMethods, + SessionMode sessionMode, IText text, IUserInterfaceFactory uiFactory) { @@ -81,6 +84,7 @@ namespace SafeExamBrowser.Browser this.logger = logger; this.messageBox = messageBox; this.nativeMethods = nativeMethods; + this.sessionMode = sessionMode; this.settings = settings; this.text = text; this.uiFactory = uiFactory; @@ -193,6 +197,7 @@ namespace SafeExamBrowser.Browser keyGenerator, windowLogger, messageBox, + sessionMode, settings, startUrl, text, diff --git a/SafeExamBrowser.Browser/BrowserWindow.cs b/SafeExamBrowser.Browser/BrowserWindow.cs index 04162fc6..d0895e7c 100644 --- a/SafeExamBrowser.Browser/BrowserWindow.cs +++ b/SafeExamBrowser.Browser/BrowserWindow.cs @@ -26,6 +26,7 @@ using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.Core.Contracts.Resources.Icons; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; +using SafeExamBrowser.Settings; using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter; using SafeExamBrowser.UserInterface.Contracts; @@ -55,6 +56,7 @@ namespace SafeExamBrowser.Browser private readonly IKeyGenerator keyGenerator; private readonly IModuleLogger logger; private readonly IMessageBox messageBox; + private readonly SessionMode sessionMode; private readonly Dictionary popups; private readonly BrowserSettings settings; private readonly string startUrl; @@ -97,6 +99,7 @@ namespace SafeExamBrowser.Browser IKeyGenerator keyGenerator, IModuleLogger logger, IMessageBox messageBox, + SessionMode sessionMode, BrowserSettings settings, string startUrl, IText text, @@ -112,6 +115,7 @@ namespace SafeExamBrowser.Browser this.logger = logger; this.messageBox = messageBox; this.popups = new Dictionary(); + this.sessionMode = sessionMode; this.settings = settings; this.startUrl = startUrl; this.text = text; @@ -153,7 +157,7 @@ namespace SafeExamBrowser.Browser var renderHandler = new RenderProcessMessageHandler(appConfig, keyGenerator, settings, text); var requestFilter = new RequestFilter(); var requestLogger = logger.CloneFor($"{nameof(RequestHandler)} #{Id}"); - var resourceHandler = new ResourceHandler(appConfig, requestFilter, keyGenerator, logger, settings, WindowSettings, text); + var resourceHandler = new ResourceHandler(appConfig, requestFilter, keyGenerator, logger, sessionMode, settings, WindowSettings, text); var requestHandler = new RequestHandler(appConfig, requestFilter, requestLogger, resourceHandler, settings, WindowSettings); Icon = new BrowserIconResource(); diff --git a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs index 35194051..4876e32d 100644 --- a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs +++ b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs @@ -23,6 +23,7 @@ using SafeExamBrowser.Configuration.Contracts; using SafeExamBrowser.Configuration.Contracts.Cryptography; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.Logging.Contracts; +using SafeExamBrowser.Settings; using SafeExamBrowser.Settings.Browser; using SafeExamBrowser.Settings.Browser.Filter; using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings; @@ -37,6 +38,7 @@ namespace SafeExamBrowser.Browser.Handlers private readonly IRequestFilter filter; private readonly IKeyGenerator keyGenerator; private readonly ILogger logger; + private readonly SessionMode sessionMode; private readonly BrowserSettings settings; private readonly WindowSettings windowSettings; @@ -51,6 +53,7 @@ namespace SafeExamBrowser.Browser.Handlers IRequestFilter filter, IKeyGenerator keyGenerator, ILogger logger, + SessionMode sessionMode, BrowserSettings settings, WindowSettings windowSettings, IText text) @@ -60,6 +63,7 @@ namespace SafeExamBrowser.Browser.Handlers this.contentLoader = new ContentLoader(text); this.keyGenerator = keyGenerator; this.logger = logger; + this.sessionMode = sessionMode; this.settings = settings; this.windowSettings = windowSettings; } @@ -94,7 +98,10 @@ namespace SafeExamBrowser.Browser.Handlers protected override void OnResourceRedirect(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl) { - SearchSessionIdentifiers(request, response); + if (sessionMode == SessionMode.Server) + { + SearchSessionIdentifiers(request, response); + } base.OnResourceRedirect(chromiumWebBrowser, browser, frame, request, response, ref newUrl); } @@ -108,7 +115,10 @@ namespace SafeExamBrowser.Browser.Handlers return true; } - SearchSessionIdentifiers(request, response); + if (sessionMode == SessionMode.Server) + { + SearchSessionIdentifiers(request, response); + } return base.OnResourceResponse(webBrowser, browser, frame, request, response); } diff --git a/SafeExamBrowser.Client/CompositionRoot.cs b/SafeExamBrowser.Client/CompositionRoot.cs index 324baadc..f63235e7 100644 --- a/SafeExamBrowser.Client/CompositionRoot.cs +++ b/SafeExamBrowser.Client/CompositionRoot.cs @@ -231,9 +231,10 @@ namespace SafeExamBrowser.Client fileSystemDialog, new HashAlgorithm(), keyGenerator, - nativeMethods, messageBox, moduleLogger, + nativeMethods, + context.Settings.SessionMode, text, uiFactory); var operation = new BrowserOperation(actionCenter, context, logger, taskbar, taskview, uiFactory);