SEBWIN-540: Implemented transmission of client and version information to SEB-Server.
This commit is contained in:
parent
43f468dc68
commit
3a5000a130
3 changed files with 32 additions and 18 deletions
|
@ -76,6 +76,7 @@ namespace SafeExamBrowser.Client
|
||||||
private ISystemInfo systemInfo;
|
private ISystemInfo systemInfo;
|
||||||
private ITaskbar taskbar;
|
private ITaskbar taskbar;
|
||||||
private ITaskview taskview;
|
private ITaskview taskview;
|
||||||
|
private IUserInfo userInfo;
|
||||||
private IText text;
|
private IText text;
|
||||||
private IUserInterfaceFactory uiFactory;
|
private IUserInterfaceFactory uiFactory;
|
||||||
private IWirelessAdapter wirelessAdapter;
|
private IWirelessAdapter wirelessAdapter;
|
||||||
|
@ -89,9 +90,10 @@ namespace SafeExamBrowser.Client
|
||||||
InitializeLogging();
|
InitializeLogging();
|
||||||
InitializeText();
|
InitializeText();
|
||||||
|
|
||||||
context = new ClientContext();
|
|
||||||
uiFactory = BuildUserInterfaceFactory();
|
uiFactory = BuildUserInterfaceFactory();
|
||||||
|
|
||||||
actionCenter = uiFactory.CreateActionCenter();
|
actionCenter = uiFactory.CreateActionCenter();
|
||||||
|
context = new ClientContext();
|
||||||
messageBox = BuildMessageBox();
|
messageBox = BuildMessageBox();
|
||||||
nativeMethods = new NativeMethods();
|
nativeMethods = new NativeMethods();
|
||||||
powerSupply = new PowerSupply(ModuleLogger(nameof(PowerSupply)));
|
powerSupply = new PowerSupply(ModuleLogger(nameof(PowerSupply)));
|
||||||
|
@ -99,6 +101,7 @@ namespace SafeExamBrowser.Client
|
||||||
systemInfo = new SystemInfo();
|
systemInfo = new SystemInfo();
|
||||||
taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar"));
|
taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar"));
|
||||||
taskview = uiFactory.CreateTaskview();
|
taskview = uiFactory.CreateTaskview();
|
||||||
|
userInfo = new UserInfo(ModuleLogger(nameof(UserInfo)));
|
||||||
wirelessAdapter = new WirelessAdapter(ModuleLogger(nameof(WirelessAdapter)));
|
wirelessAdapter = new WirelessAdapter(ModuleLogger(nameof(WirelessAdapter)));
|
||||||
|
|
||||||
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
|
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
|
||||||
|
@ -268,7 +271,7 @@ namespace SafeExamBrowser.Client
|
||||||
|
|
||||||
private IOperation BuildServerOperation()
|
private IOperation BuildServerOperation()
|
||||||
{
|
{
|
||||||
var server = new ServerProxy(context.AppConfig, ModuleLogger(nameof(ServerProxy)), powerSupply, wirelessAdapter);
|
var server = new ServerProxy(context.AppConfig, ModuleLogger(nameof(ServerProxy)), systemInfo, userInfo, powerSupply, wirelessAdapter);
|
||||||
var operation = new ServerOperation(context, logger, server);
|
var operation = new ServerOperation(context, logger, server);
|
||||||
|
|
||||||
context.Server = server;
|
context.Server = server;
|
||||||
|
|
|
@ -58,25 +58,26 @@ namespace SafeExamBrowser.Runtime
|
||||||
InitializeLogging();
|
InitializeLogging();
|
||||||
InitializeText();
|
InitializeText();
|
||||||
|
|
||||||
var args = Environment.GetCommandLineArgs();
|
|
||||||
var messageBox = new MessageBoxFactory(text);
|
|
||||||
var nativeMethods = new NativeMethods();
|
var nativeMethods = new NativeMethods();
|
||||||
var uiFactory = new UserInterfaceFactory(text);
|
var uiFactory = new UserInterfaceFactory(text);
|
||||||
|
var userInfo = new UserInfo(ModuleLogger(nameof(UserInfo)));
|
||||||
|
|
||||||
|
var args = Environment.GetCommandLineArgs();
|
||||||
var desktopFactory = new DesktopFactory(ModuleLogger(nameof(DesktopFactory)));
|
var desktopFactory = new DesktopFactory(ModuleLogger(nameof(DesktopFactory)));
|
||||||
var desktopMonitor = new DesktopMonitor(ModuleLogger(nameof(DesktopMonitor)));
|
var desktopMonitor = new DesktopMonitor(ModuleLogger(nameof(DesktopMonitor)));
|
||||||
var displayMonitor = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo);
|
var displayMonitor = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo);
|
||||||
var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods);
|
var explorerShell = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods);
|
||||||
var fileSystem = new FileSystem();
|
var fileSystem = new FileSystem();
|
||||||
|
var messageBox = new MessageBoxFactory(text);
|
||||||
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
|
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
|
||||||
var proxyFactory = new ProxyFactory(new ProxyObjectFactory(), ModuleLogger(nameof(ProxyFactory)));
|
var proxyFactory = new ProxyFactory(new ProxyObjectFactory(), ModuleLogger(nameof(ProxyFactory)));
|
||||||
var remoteSessionDetector = new RemoteSessionDetector(ModuleLogger(nameof(RemoteSessionDetector)));
|
var remoteSessionDetector = new RemoteSessionDetector(ModuleLogger(nameof(RemoteSessionDetector)));
|
||||||
var runtimeHost = new RuntimeHost(appConfig.RuntimeAddress, new HostObjectFactory(), ModuleLogger(nameof(RuntimeHost)), FIVE_SECONDS);
|
var runtimeHost = new RuntimeHost(appConfig.RuntimeAddress, new HostObjectFactory(), ModuleLogger(nameof(RuntimeHost)), FIVE_SECONDS);
|
||||||
var runtimeWindow = uiFactory.CreateRuntimeWindow(appConfig);
|
var runtimeWindow = uiFactory.CreateRuntimeWindow(appConfig);
|
||||||
var server = new ServerProxy(appConfig, ModuleLogger(nameof(ServerProxy)));
|
var server = new ServerProxy(appConfig, ModuleLogger(nameof(ServerProxy)), systemInfo, userInfo);
|
||||||
var serviceProxy = new ServiceProxy(appConfig.ServiceAddress, new ProxyObjectFactory(), ModuleLogger(nameof(ServiceProxy)), Interlocutor.Runtime);
|
var serviceProxy = new ServiceProxy(appConfig.ServiceAddress, new ProxyObjectFactory(), ModuleLogger(nameof(ServiceProxy)), Interlocutor.Runtime);
|
||||||
var sessionContext = new SessionContext();
|
var sessionContext = new SessionContext();
|
||||||
var splashScreen = uiFactory.CreateSplashScreen(appConfig);
|
var splashScreen = uiFactory.CreateSplashScreen(appConfig);
|
||||||
var userInfo = new UserInfo(ModuleLogger(nameof(UserInfo)));
|
|
||||||
var vmDetector = new VirtualMachineDetector(ModuleLogger(nameof(VirtualMachineDetector)), systemInfo);
|
var vmDetector = new VirtualMachineDetector(ModuleLogger(nameof(VirtualMachineDetector)), systemInfo);
|
||||||
|
|
||||||
var bootstrapOperations = new Queue<IOperation>();
|
var bootstrapOperations = new Queue<IOperation>();
|
||||||
|
|
|
@ -25,6 +25,7 @@ using SafeExamBrowser.Server.Contracts.Events;
|
||||||
using SafeExamBrowser.Server.Data;
|
using SafeExamBrowser.Server.Data;
|
||||||
using SafeExamBrowser.Settings.Logging;
|
using SafeExamBrowser.Settings.Logging;
|
||||||
using SafeExamBrowser.Settings.Server;
|
using SafeExamBrowser.Settings.Server;
|
||||||
|
using SafeExamBrowser.SystemComponents.Contracts;
|
||||||
using SafeExamBrowser.SystemComponents.Contracts.PowerSupply;
|
using SafeExamBrowser.SystemComponents.Contracts.PowerSupply;
|
||||||
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
|
using SafeExamBrowser.SystemComponents.Contracts.WirelessNetwork;
|
||||||
using Timer = System.Timers.Timer;
|
using Timer = System.Timers.Timer;
|
||||||
|
@ -33,27 +34,30 @@ namespace SafeExamBrowser.Server
|
||||||
{
|
{
|
||||||
public class ServerProxy : ILogObserver, IServerProxy
|
public class ServerProxy : ILogObserver, IServerProxy
|
||||||
{
|
{
|
||||||
|
private readonly AppConfig appConfig;
|
||||||
|
private readonly FileSystem fileSystem;
|
||||||
|
private readonly HttpClient httpClient;
|
||||||
|
private readonly ConcurrentQueue<string> instructionConfirmations;
|
||||||
|
private readonly ILogger logger;
|
||||||
|
private readonly ConcurrentQueue<ILogContent> logContent;
|
||||||
|
private readonly Timer logTimer;
|
||||||
|
private readonly Parser parser;
|
||||||
|
private readonly Timer pingTimer;
|
||||||
|
private readonly IPowerSupply powerSupply;
|
||||||
|
private readonly ISystemInfo systemInfo;
|
||||||
|
private readonly IUserInfo userInfo;
|
||||||
|
private readonly IWirelessAdapter wirelessAdapter;
|
||||||
|
|
||||||
private ApiVersion1 api;
|
private ApiVersion1 api;
|
||||||
private AppConfig appConfig;
|
|
||||||
private FileSystem fileSystem;
|
|
||||||
private string connectionToken;
|
private string connectionToken;
|
||||||
private int currentPowerSupplyValue;
|
private int currentPowerSupplyValue;
|
||||||
private bool connectedToPowergrid;
|
private bool connectedToPowergrid;
|
||||||
private int currentWlanValue;
|
private int currentWlanValue;
|
||||||
private string examId;
|
private string examId;
|
||||||
private int handNotificationId;
|
private int handNotificationId;
|
||||||
private HttpClient httpClient;
|
|
||||||
private ConcurrentQueue<string> instructionConfirmations;
|
|
||||||
private ILogger logger;
|
|
||||||
private ConcurrentQueue<ILogContent> logContent;
|
|
||||||
private Timer logTimer;
|
|
||||||
private Parser parser;
|
|
||||||
private string oauth2Token;
|
private string oauth2Token;
|
||||||
private int pingNumber;
|
private int pingNumber;
|
||||||
private Timer pingTimer;
|
|
||||||
private IPowerSupply powerSupply;
|
|
||||||
private ServerSettings settings;
|
private ServerSettings settings;
|
||||||
private IWirelessAdapter wirelessAdapter;
|
|
||||||
|
|
||||||
public event ServerEventHandler HandConfirmed;
|
public event ServerEventHandler HandConfirmed;
|
||||||
public event ProctoringConfigurationReceivedEventHandler ProctoringConfigurationReceived;
|
public event ProctoringConfigurationReceivedEventHandler ProctoringConfigurationReceived;
|
||||||
|
@ -63,6 +67,8 @@ namespace SafeExamBrowser.Server
|
||||||
public ServerProxy(
|
public ServerProxy(
|
||||||
AppConfig appConfig,
|
AppConfig appConfig,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
|
ISystemInfo systemInfo,
|
||||||
|
IUserInfo userInfo,
|
||||||
IPowerSupply powerSupply = default(IPowerSupply),
|
IPowerSupply powerSupply = default(IPowerSupply),
|
||||||
IWirelessAdapter wirelessAdapter = default(IWirelessAdapter))
|
IWirelessAdapter wirelessAdapter = default(IWirelessAdapter))
|
||||||
{
|
{
|
||||||
|
@ -77,6 +83,8 @@ namespace SafeExamBrowser.Server
|
||||||
this.parser = new Parser(logger);
|
this.parser = new Parser(logger);
|
||||||
this.pingTimer = new Timer();
|
this.pingTimer = new Timer();
|
||||||
this.powerSupply = powerSupply;
|
this.powerSupply = powerSupply;
|
||||||
|
this.systemInfo = systemInfo;
|
||||||
|
this.userInfo = userInfo;
|
||||||
this.wirelessAdapter = wirelessAdapter;
|
this.wirelessAdapter = wirelessAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +306,9 @@ namespace SafeExamBrowser.Server
|
||||||
public ServerResponse SendSessionIdentifier(string identifier)
|
public ServerResponse SendSessionIdentifier(string identifier)
|
||||||
{
|
{
|
||||||
var authorization = ("Authorization", $"Bearer {oauth2Token}");
|
var authorization = ("Authorization", $"Bearer {oauth2Token}");
|
||||||
var content = $"examId={examId}&seb_user_session_id={identifier}";
|
var clientInfo = $"client_id={userInfo.GetUserName()}&seb_machine_name={systemInfo.Name}";
|
||||||
|
var versionInfo = $"seb_os_name={systemInfo.OperatingSystemInfo}&seb_version={appConfig.ProgramInformationalVersion}";
|
||||||
|
var content = $"examId={examId}&{clientInfo}&{versionInfo}&seb_user_session_id={identifier}";
|
||||||
var contentType = "application/x-www-form-urlencoded";
|
var contentType = "application/x-www-form-urlencoded";
|
||||||
var token = ("SEBConnectionToken", connectionToken);
|
var token = ("SEBConnectionToken", connectionToken);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue