SEBWIN-640, #552: Only search for an LMS session identifier when a server session is active.
This commit is contained in:
parent
7967087ee6
commit
8c687e69a8
6 changed files with 30 additions and 8 deletions
|
@ -48,7 +48,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers
|
||||||
settings = new BrowserSettings();
|
settings = new BrowserSettings();
|
||||||
windowSettings = new WindowSettings();
|
windowSettings = new WindowSettings();
|
||||||
text = new Mock<IText>();
|
text = new Mock<IText>();
|
||||||
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);
|
sut = new TestableRequestHandler(appConfig, filter.Object, logger.Object, resourceHandler, settings, windowSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ using SafeExamBrowser.Configuration.Contracts;
|
||||||
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||||
using SafeExamBrowser.I18n.Contracts;
|
using SafeExamBrowser.I18n.Contracts;
|
||||||
using SafeExamBrowser.Logging.Contracts;
|
using SafeExamBrowser.Logging.Contracts;
|
||||||
|
using SafeExamBrowser.Settings;
|
||||||
using SafeExamBrowser.Settings.Browser;
|
using SafeExamBrowser.Settings.Browser;
|
||||||
using SafeExamBrowser.Settings.Browser.Filter;
|
using SafeExamBrowser.Settings.Browser.Filter;
|
||||||
using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings;
|
using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings;
|
||||||
|
@ -49,7 +50,7 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers
|
||||||
windowSettings = new WindowSettings();
|
windowSettings = new WindowSettings();
|
||||||
text = new Mock<IText>();
|
text = new Mock<IText>();
|
||||||
|
|
||||||
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]
|
[TestMethod]
|
||||||
|
@ -298,9 +299,10 @@ namespace SafeExamBrowser.Browser.UnitTests.Handlers
|
||||||
IRequestFilter filter,
|
IRequestFilter filter,
|
||||||
IKeyGenerator keyGenerator,
|
IKeyGenerator keyGenerator,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
|
SessionMode sessionMode,
|
||||||
BrowserSettings settings,
|
BrowserSettings settings,
|
||||||
WindowSettings windowSettings,
|
WindowSettings windowSettings,
|
||||||
IText text) : base(appConfig, filter, keyGenerator, logger, settings, windowSettings, text)
|
IText text) : base(appConfig, filter, keyGenerator, logger, sessionMode, settings, windowSettings, text)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||||
using SafeExamBrowser.Core.Contracts.Resources.Icons;
|
using SafeExamBrowser.Core.Contracts.Resources.Icons;
|
||||||
using SafeExamBrowser.I18n.Contracts;
|
using SafeExamBrowser.I18n.Contracts;
|
||||||
using SafeExamBrowser.Logging.Contracts;
|
using SafeExamBrowser.Logging.Contracts;
|
||||||
|
using SafeExamBrowser.Settings;
|
||||||
using SafeExamBrowser.Settings.Browser.Proxy;
|
using SafeExamBrowser.Settings.Browser.Proxy;
|
||||||
using SafeExamBrowser.Settings.Logging;
|
using SafeExamBrowser.Settings.Logging;
|
||||||
using SafeExamBrowser.UserInterface.Contracts;
|
using SafeExamBrowser.UserInterface.Contracts;
|
||||||
|
@ -45,6 +46,7 @@ namespace SafeExamBrowser.Browser
|
||||||
private readonly IModuleLogger logger;
|
private readonly IModuleLogger logger;
|
||||||
private readonly IMessageBox messageBox;
|
private readonly IMessageBox messageBox;
|
||||||
private readonly INativeMethods nativeMethods;
|
private readonly INativeMethods nativeMethods;
|
||||||
|
private readonly SessionMode sessionMode;
|
||||||
private readonly BrowserSettings settings;
|
private readonly BrowserSettings settings;
|
||||||
private readonly IText text;
|
private readonly IText text;
|
||||||
private readonly IUserInterfaceFactory uiFactory;
|
private readonly IUserInterfaceFactory uiFactory;
|
||||||
|
@ -68,9 +70,10 @@ namespace SafeExamBrowser.Browser
|
||||||
IFileSystemDialog fileSystemDialog,
|
IFileSystemDialog fileSystemDialog,
|
||||||
IHashAlgorithm hashAlgorithm,
|
IHashAlgorithm hashAlgorithm,
|
||||||
IKeyGenerator keyGenerator,
|
IKeyGenerator keyGenerator,
|
||||||
INativeMethods nativeMethods,
|
|
||||||
IMessageBox messageBox,
|
IMessageBox messageBox,
|
||||||
IModuleLogger logger,
|
IModuleLogger logger,
|
||||||
|
INativeMethods nativeMethods,
|
||||||
|
SessionMode sessionMode,
|
||||||
IText text,
|
IText text,
|
||||||
IUserInterfaceFactory uiFactory)
|
IUserInterfaceFactory uiFactory)
|
||||||
{
|
{
|
||||||
|
@ -81,6 +84,7 @@ namespace SafeExamBrowser.Browser
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.messageBox = messageBox;
|
this.messageBox = messageBox;
|
||||||
this.nativeMethods = nativeMethods;
|
this.nativeMethods = nativeMethods;
|
||||||
|
this.sessionMode = sessionMode;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.uiFactory = uiFactory;
|
this.uiFactory = uiFactory;
|
||||||
|
@ -193,6 +197,7 @@ namespace SafeExamBrowser.Browser
|
||||||
keyGenerator,
|
keyGenerator,
|
||||||
windowLogger,
|
windowLogger,
|
||||||
messageBox,
|
messageBox,
|
||||||
|
sessionMode,
|
||||||
settings,
|
settings,
|
||||||
startUrl,
|
startUrl,
|
||||||
text,
|
text,
|
||||||
|
|
|
@ -26,6 +26,7 @@ using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||||
using SafeExamBrowser.Core.Contracts.Resources.Icons;
|
using SafeExamBrowser.Core.Contracts.Resources.Icons;
|
||||||
using SafeExamBrowser.I18n.Contracts;
|
using SafeExamBrowser.I18n.Contracts;
|
||||||
using SafeExamBrowser.Logging.Contracts;
|
using SafeExamBrowser.Logging.Contracts;
|
||||||
|
using SafeExamBrowser.Settings;
|
||||||
using SafeExamBrowser.Settings.Browser;
|
using SafeExamBrowser.Settings.Browser;
|
||||||
using SafeExamBrowser.Settings.Browser.Filter;
|
using SafeExamBrowser.Settings.Browser.Filter;
|
||||||
using SafeExamBrowser.UserInterface.Contracts;
|
using SafeExamBrowser.UserInterface.Contracts;
|
||||||
|
@ -55,6 +56,7 @@ namespace SafeExamBrowser.Browser
|
||||||
private readonly IKeyGenerator keyGenerator;
|
private readonly IKeyGenerator keyGenerator;
|
||||||
private readonly IModuleLogger logger;
|
private readonly IModuleLogger logger;
|
||||||
private readonly IMessageBox messageBox;
|
private readonly IMessageBox messageBox;
|
||||||
|
private readonly SessionMode sessionMode;
|
||||||
private readonly Dictionary<int, BrowserWindow> popups;
|
private readonly Dictionary<int, BrowserWindow> popups;
|
||||||
private readonly BrowserSettings settings;
|
private readonly BrowserSettings settings;
|
||||||
private readonly string startUrl;
|
private readonly string startUrl;
|
||||||
|
@ -97,6 +99,7 @@ namespace SafeExamBrowser.Browser
|
||||||
IKeyGenerator keyGenerator,
|
IKeyGenerator keyGenerator,
|
||||||
IModuleLogger logger,
|
IModuleLogger logger,
|
||||||
IMessageBox messageBox,
|
IMessageBox messageBox,
|
||||||
|
SessionMode sessionMode,
|
||||||
BrowserSettings settings,
|
BrowserSettings settings,
|
||||||
string startUrl,
|
string startUrl,
|
||||||
IText text,
|
IText text,
|
||||||
|
@ -112,6 +115,7 @@ namespace SafeExamBrowser.Browser
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.messageBox = messageBox;
|
this.messageBox = messageBox;
|
||||||
this.popups = new Dictionary<int, BrowserWindow>();
|
this.popups = new Dictionary<int, BrowserWindow>();
|
||||||
|
this.sessionMode = sessionMode;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.startUrl = startUrl;
|
this.startUrl = startUrl;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
@ -153,7 +157,7 @@ namespace SafeExamBrowser.Browser
|
||||||
var renderHandler = new RenderProcessMessageHandler(appConfig, keyGenerator, settings, text);
|
var renderHandler = new RenderProcessMessageHandler(appConfig, keyGenerator, settings, text);
|
||||||
var requestFilter = new RequestFilter();
|
var requestFilter = new RequestFilter();
|
||||||
var requestLogger = logger.CloneFor($"{nameof(RequestHandler)} #{Id}");
|
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);
|
var requestHandler = new RequestHandler(appConfig, requestFilter, requestLogger, resourceHandler, settings, WindowSettings);
|
||||||
|
|
||||||
Icon = new BrowserIconResource();
|
Icon = new BrowserIconResource();
|
||||||
|
|
|
@ -23,6 +23,7 @@ using SafeExamBrowser.Configuration.Contracts;
|
||||||
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||||
using SafeExamBrowser.I18n.Contracts;
|
using SafeExamBrowser.I18n.Contracts;
|
||||||
using SafeExamBrowser.Logging.Contracts;
|
using SafeExamBrowser.Logging.Contracts;
|
||||||
|
using SafeExamBrowser.Settings;
|
||||||
using SafeExamBrowser.Settings.Browser;
|
using SafeExamBrowser.Settings.Browser;
|
||||||
using SafeExamBrowser.Settings.Browser.Filter;
|
using SafeExamBrowser.Settings.Browser.Filter;
|
||||||
using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings;
|
using BrowserSettings = SafeExamBrowser.Settings.Browser.BrowserSettings;
|
||||||
|
@ -37,6 +38,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
private readonly IRequestFilter filter;
|
private readonly IRequestFilter filter;
|
||||||
private readonly IKeyGenerator keyGenerator;
|
private readonly IKeyGenerator keyGenerator;
|
||||||
private readonly ILogger logger;
|
private readonly ILogger logger;
|
||||||
|
private readonly SessionMode sessionMode;
|
||||||
private readonly BrowserSettings settings;
|
private readonly BrowserSettings settings;
|
||||||
private readonly WindowSettings windowSettings;
|
private readonly WindowSettings windowSettings;
|
||||||
|
|
||||||
|
@ -51,6 +53,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
IRequestFilter filter,
|
IRequestFilter filter,
|
||||||
IKeyGenerator keyGenerator,
|
IKeyGenerator keyGenerator,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
|
SessionMode sessionMode,
|
||||||
BrowserSettings settings,
|
BrowserSettings settings,
|
||||||
WindowSettings windowSettings,
|
WindowSettings windowSettings,
|
||||||
IText text)
|
IText text)
|
||||||
|
@ -60,6 +63,7 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
this.contentLoader = new ContentLoader(text);
|
this.contentLoader = new ContentLoader(text);
|
||||||
this.keyGenerator = keyGenerator;
|
this.keyGenerator = keyGenerator;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.sessionMode = sessionMode;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.windowSettings = windowSettings;
|
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)
|
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);
|
base.OnResourceRedirect(chromiumWebBrowser, browser, frame, request, response, ref newUrl);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +115,10 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchSessionIdentifiers(request, response);
|
if (sessionMode == SessionMode.Server)
|
||||||
|
{
|
||||||
|
SearchSessionIdentifiers(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnResourceResponse(webBrowser, browser, frame, request, response);
|
return base.OnResourceResponse(webBrowser, browser, frame, request, response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,9 +231,10 @@ namespace SafeExamBrowser.Client
|
||||||
fileSystemDialog,
|
fileSystemDialog,
|
||||||
new HashAlgorithm(),
|
new HashAlgorithm(),
|
||||||
keyGenerator,
|
keyGenerator,
|
||||||
nativeMethods,
|
|
||||||
messageBox,
|
messageBox,
|
||||||
moduleLogger,
|
moduleLogger,
|
||||||
|
nativeMethods,
|
||||||
|
context.Settings.SessionMode,
|
||||||
text,
|
text,
|
||||||
uiFactory);
|
uiFactory);
|
||||||
var operation = new BrowserOperation(actionCenter, context, logger, taskbar, taskview, uiFactory);
|
var operation = new BrowserOperation(actionCenter, context, logger, taskbar, taskview, uiFactory);
|
||||||
|
|
Loading…
Reference in a new issue