SEBWIN-483: Implemented generic method to retrieve LMS session identifier.

This commit is contained in:
Damian Büchel 2021-04-21 19:53:52 +02:00
parent a9af0f41bc
commit a33c7c0ff9

View file

@ -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)