diff --git a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs index 48f3475e..930a71c1 100644 --- a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs +++ b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs @@ -246,8 +246,33 @@ namespace SafeExamBrowser.Browser.Handlers private void SearchSessionIdentifiers(IRequest request, IResponse response) { - SearchEdxIdentifier(response); - SearchMoodleIdentifier(request, response); + var success = TrySearchGenericSessionIdentifier(response); + + if (!success) + { + SearchEdxIdentifier(response); + SearchMoodleIdentifier(request, response); + } + } + + private bool TrySearchGenericSessionIdentifier(IResponse response) + { + var ids = response.Headers.GetValues("X-LMS-USER-ID"); + + if (ids != default(string[])) + { + var userId = ids.FirstOrDefault(); + + if (userId != default(string)) + { + Task.Run(() => SessionIdentifierDetected?.Invoke(userId)); + logger.Info("Generic LMS session detected."); + + return true; + } + } + + return false; } private void SearchEdxIdentifier(IResponse response)