SEBWIN-483: Implemented generic method to retrieve LMS session identifier.
This commit is contained in:
parent
a9af0f41bc
commit
a33c7c0ff9
1 changed files with 27 additions and 2 deletions
|
@ -246,8 +246,33 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
|
|
||||||
private void SearchSessionIdentifiers(IRequest request, IResponse response)
|
private void SearchSessionIdentifiers(IRequest request, IResponse response)
|
||||||
{
|
{
|
||||||
SearchEdxIdentifier(response);
|
var success = TrySearchGenericSessionIdentifier(response);
|
||||||
SearchMoodleIdentifier(request, 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)
|
private void SearchEdxIdentifier(IResponse response)
|
||||||
|
|
Loading…
Reference in a new issue