Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.Settings.Applications;
using SafeExamBrowser.Settings.Browser;
using SafeExamBrowser.Settings.Logging;
using SafeExamBrowser.Settings.Monitoring;
using SafeExamBrowser.Settings.Proctoring;
using SafeExamBrowser.Settings.Security;
using SafeExamBrowser.Settings.Server;
using SafeExamBrowser.Settings.Service;
using SafeExamBrowser.Settings.System;
using SafeExamBrowser.Settings.SystemComponents;
using SafeExamBrowser.Settings.UserInterface;
namespace SafeExamBrowser.Settings
{
/// <summary>
/// Defines all settings for the application.
/// </summary>
[Serializable]
public class AppSettings
{
/// <summary>
/// All settings related to external applications.
/// </summary>
public ApplicationSettings Applications { get; set; }
/// <summary>
/// All audio-related settings.
/// </summary>
public AudioSettings Audio { get; set; }
/// <summary>
/// All browser-related settings.
/// </summary>
public BrowserSettings Browser { get; set; }
/// <summary>
/// The mode which determines the configuration behaviour.
/// </summary>
public ConfigurationMode ConfigurationMode { get; set; }
/// <summary>
/// All display-related settings.
/// </summary>
public DisplaySettings Display { get; set; }
/// <summary>
/// All keyboard-related settings.
/// </summary>
public KeyboardSettings Keyboard { get; set; }
/// <summary>
/// The global log severity to be used.
/// </summary>
public LogLevel LogLevel { get; set; }
/// <summary>
/// All mouse-related settings.
/// </summary>
public MouseSettings Mouse { get; set; }
/// <summary>
/// All settings related to the power supply.
/// </summary>
public PowerSupplySettings PowerSupply { get; set; }
/// <summary>
/// All proctoring-related settings.
/// </summary>
public ProctoringSettings Proctoring { get; set; }
/// <summary>
/// All security-related settings.
/// </summary>
public SecuritySettings Security { get; set; }
/// <summary>
/// All server-related settings.
/// </summary>
public ServerSettings Server { get; set; }
/// <summary>
/// All service-related settings.
/// </summary>
public ServiceSettings Service { get; set; }
/// <summary>
/// The mode which determines the session behaviour.
/// </summary>
public SessionMode SessionMode { get; set; }
/// <summary>
/// All system-related settings.
/// </summary>
public SystemSettings System { get; set; }
/// <summary>
/// All settings related to the user interface.
/// </summary>
public UserInterfaceSettings UserInterface { get; set; }
public AppSettings()
{
Applications = new ApplicationSettings();
Audio = new AudioSettings();
Browser = new BrowserSettings();
Display = new DisplaySettings();
Keyboard = new KeyboardSettings();
Mouse = new MouseSettings();
PowerSupply = new PowerSupplySettings();
Proctoring = new ProctoringSettings();
Security = new SecuritySettings();
Server = new ServerSettings();
Service = new ServiceSettings();
System = new SystemSettings();
UserInterface = new UserInterfaceSettings();
}
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
namespace SafeExamBrowser.Settings.Applications
{
/// <summary>
/// Defines all settings for external applications and application monitoring.
/// </summary>
[Serializable]
public class ApplicationSettings
{
/// <summary>
/// All applications which are not allowed to run during a session.
/// </summary>
public IList<BlacklistApplication> Blacklist { get; set; }
/// <summary>
/// All applications which are allowed to run during a session.
/// </summary>
public IList<WhitelistApplication> Whitelist { get; set; }
public ApplicationSettings()
{
Blacklist = new List<BlacklistApplication>();
Whitelist = new List<WhitelistApplication>();
}
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Applications
{
/// <summary>
/// Defines an application which is blacklisted, i.e. not allowed to run during a session.
/// </summary>
[Serializable]
public class BlacklistApplication
{
/// <summary>
/// Specifies whether the application may be automatically terminated when starting a session.
/// </summary>
public bool AutoTerminate { get; set; }
/// <summary>
/// The name of the main executable of the application.
/// </summary>
public string ExecutableName { get; set; }
/// <summary>
/// The original file name of the main executable of the application, if available.
/// </summary>
public string OriginalName { get; set; }
}
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
namespace SafeExamBrowser.Settings.Applications
{
/// <summary>
/// Defines an application which is whitelisted, i.e. allowed to run during a session.
/// </summary>
[Serializable]
public class WhitelistApplication
{
/// <summary>
/// Determines whether the user may choose a custom path if the main executable cannot be found under <see cref="ExecutablePath"/>.
/// </summary>
public bool AllowCustomPath { get; set; }
/// <summary>
/// Determines whether the application may already be running when initializing a session. If <c>true</c>, <see cref="AutoTerminate"/> will be ignored.
/// </summary>
public bool AllowRunning { get; set; }
/// <summary>
/// The list of arguments to be used when starting the application.
/// </summary>
public IList<string> Arguments { get; }
/// <summary>
/// Determines whether the application will be automatically started when initializing a session.
/// </summary>
public bool AutoStart { get; set; }
/// <summary>
/// Specifies whether the application may be automatically terminated when starting a session. Is ignored if <see cref="AllowRunning"/> is set.
/// </summary>
public bool AutoTerminate { get; set; }
/// <summary>
/// Provides further information about the application.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The display name to be used for the application (e.g. in the shell).
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// The file name of the main executable of the application.
/// </summary>
public string ExecutableName { get; set; }
/// <summary>
/// The path where the main executable of the application is located.
/// </summary>
public string ExecutablePath { get; set; }
/// <summary>
/// Unique identifier to be used to identify the application during runtime.
/// </summary>
public Guid Id { get; }
/// <summary>
/// The original file name of the main executable of the application, if available.
/// </summary>
public string OriginalName { get; set; }
/// <summary>
/// Determines whether the user will be able to access the application via the shell.
/// </summary>
public bool ShowInShell { get; set; }
/// <summary>
/// The signature of the main executable of the application, if available.
/// </summary>
public string Signature { get; set; }
public WhitelistApplication()
{
Arguments = new List<string>();
Id = Guid.NewGuid();
}
}
}

View File

@@ -0,0 +1,239 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines all settings for the integrated browser application.
/// </summary>
[Serializable]
public class BrowserSettings
{
/// <summary>
/// The settings to be used for additional browser windows.
/// </summary>
public WindowSettings AdditionalWindow { get; set; }
/// <summary>
/// Determines whether the user will be allowed to download configuration files.
/// </summary>
public bool AllowConfigurationDownloads { get; set; }
/// <summary>
/// Determines whether the user will be allowed to select a custom location when down- or uploading a file (excluding configuration files).
/// </summary>
public bool AllowCustomDownAndUploadLocation { get; set; }
/// <summary>
/// Determines whether the user will be allowed to download files (excluding configuration files).
/// </summary>
public bool AllowDownloads { get; set; }
/// <summary>
/// Determines whether the user will be allowed to search page contents.
/// </summary>
public bool AllowFind { get; set; }
/// <summary>
/// Determines whether the user will be allowed to zoom webpages.
/// </summary>
public bool AllowPageZoom { get; set; }
/// <summary>
/// Determines whether the internal PDF reader of the browser application is enabled. If not, documents will be downloaded by default.
/// </summary>
public bool AllowPdfReader { get; set; }
/// <summary>
/// Determines whether the toolbar of the internal PDF reader (which allows to e.g. download or print a document) will be enabled.
/// </summary>
public bool AllowPdfReaderToolbar { get; set; }
/// <summary>
/// Determines whether the user will be allowed to print web content. To control printing in PDF documents, see <see cref="AllowPdfReaderToolbar"/>.
/// </summary>
public bool AllowPrint { get; set; }
/// <summary>
/// Determines whether spell checking is enabled for input fields.
/// </summary>
public bool AllowSpellChecking { get; set; }
/// <summary>
/// Determines whether the user will be allowed to upload files.
/// </summary>
public bool AllowUploads { get; set; }
/// <summary>
/// The salt value for the calculation of the browser exam key which is used for integrity checks with server applications (see also <see cref="SendBrowserExamKey"/>).
/// </summary>
public byte[] BrowserExamKeySalt { get; set; }
/// <summary>
/// The configuration key used for integrity checks with server applications (see also <see cref="SendConfigurationKey"/>).
/// </summary>
public string ConfigurationKey { get; set; }
/// <summary>
/// Determines whether the user needs to confirm the termination of SEB by <see cref="QuitUrl"/>.
/// </summary>
public bool ConfirmQuitUrl { get; set; }
/// <summary>
/// An optional, custom browser exam key used for integrity checks with server applications (see also <see cref="SendBrowserExamKey"/>).
/// </summary>
public string CustomBrowserExamKey { get; set; }
/// <summary>
/// The custom user agent to optionally be used for all requests.
/// </summary>
public string CustomUserAgent { get; set; }
/// <summary>
/// Determines whether the entire browser cache is deleted when terminating the application. IMPORTANT: If <see cref="DeleteCookiesOnShutdown"/>
/// is set to <c>false</c>, the cache will not be deleted in order to keep the cookies for the next session.
/// </summary>
public bool DeleteCacheOnShutdown { get; set; }
/// <summary>
/// Determines whether all cookies are deleted when terminating the browser application. IMPORTANT: The browser cache will not be deleted
/// if set to <c>false</c>, even if <see cref="DeleteCacheOnShutdown"/> is set to <c>true</c>!
/// </summary>
public bool DeleteCookiesOnShutdown { get; set; }
/// <summary>
/// Determines whether all cookies are deleted when starting the browser application.
/// </summary>
public bool DeleteCookiesOnStartup { get; set; }
/// <summary>
/// Defines a custom directory for down- and uploads. If not defined, all operations will be directed to the current user's download directory.
/// </summary>
public string DownAndUploadDirectory { get; set; }
/// <summary>
/// Determines whether the user is allowed to use the integrated browser application.
/// </summary>
public bool EnableBrowser { get; set; }
/// <summary>
/// The settings to be used for the browser request filter.
/// </summary>
public FilterSettings Filter { get; set; }
/// <summary>
/// An optional custom message shown before navigating home.
/// </summary>
public string HomeNavigationMessage { get; set; }
/// <summary>
/// Determines whether a password is required to navigate home.
/// </summary>
public bool HomeNavigationRequiresPassword { get; set; }
/// <summary>
/// The hash code of the password optionally required to navigate home.
/// </summary>
public string HomePasswordHash { get; set; }
/// <summary>
/// An optional custom URL to be used when navigating home.
/// </summary>
public string HomeUrl { get; set; }
/// <summary>
/// The settings to be used for the main browser window.
/// </summary>
public WindowSettings MainWindow { get; set; }
/// <summary>
/// Determines how attempts to open a popup are handled.
/// </summary>
public PopupPolicy PopupPolicy { get; set; }
/// <summary>
/// Determines the proxy settings to be used by the browser.
/// </summary>
public ProxySettings Proxy { get; set; }
/// <summary>
/// An URL which will initiate the termination of SEB (or reset the browser if <see cref="ResetOnQuitUrl"/> is <c>true</c>) when visited by the user.
/// </summary>
public string QuitUrl { get; set; }
/// <summary>
/// Determines whether the browser should be reset when a <see cref="QuitUrl"/> is detected.
/// </summary>
public bool ResetOnQuitUrl { get; set; }
/// <summary>
/// Determines whether the configuration key header is sent with every HTTP request (see also <see cref="ConfigurationKey"/>).
/// </summary>
public bool SendConfigurationKey { get; set; }
/// <summary>
/// Determines whether the browser exam key header is sent with every HTTP request (see also <see cref="BrowserExamKeySalt"/> and <see cref="CustomBrowserExamKey"/>).
/// </summary>
public bool SendBrowserExamKey { get; set; }
/// <summary>
/// Determines whether the user will be able to see the path of a file system element in the file system dialog (e.g. when down- or uploading a file).
/// </summary>
public bool ShowFileSystemElementPath { get; set; }
/// <summary>
/// The URL with which the main browser window will be loaded.
/// </summary>
public string StartUrl { get; set; }
/// <summary>
/// A query for the <see cref="StartUrl"/> which SEB automatically extracts from the configuration URL.
/// </summary>
public string StartUrlQuery { get; set; }
/// <summary>
/// Determines whether a custom user agent will be used for all requests, see <see cref="CustomUserAgent"/>.
/// </summary>
public bool UseCustomUserAgent { get; set; }
/// <summary>
/// Determines whether the browser application will use an isolated clipboard only working within the browser itself.
/// </summary>
public bool UseIsolatedClipboard { get; set; }
/// <summary>
/// Determines whether the <see cref="StartUrlQuery"/> will be appended to the <see cref="StartUrl"/>.
/// </summary>
public bool UseQueryParameter { get; set; }
/// <summary>
/// A custom suffix to be appended to the user agent.
/// </summary>
public string UserAgentSuffix { get; set; }
/// <summary>
/// Determines whether the start URL will be used when navigating home.
/// </summary>
public bool UseStartUrlAsHomeUrl { get; set; }
/// <summary>
/// Determines whether a temporary directory should be used for down- and uploads.
/// </summary>
public bool UseTemporaryDownAndUploadDirectory { get; set; }
public BrowserSettings()
{
AdditionalWindow = new WindowSettings();
Filter = new FilterSettings();
MainWindow = new WindowSettings();
Proxy = new ProxySettings();
}
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser.Filter
{
/// <summary>
/// Defines all possible results of a request filter operation.
/// </summary>
public enum FilterResult
{
/// <summary>
/// Indicates that a request should be allowed if a filter matches.
/// </summary>
Allow,
/// <summary>
/// Indicates that a request should be blocked if a filter matches.
/// </summary>
Block
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Browser.Filter
{
/// <summary>
/// Defines the settings for a request filter rule.
/// </summary>
[Serializable]
public class FilterRuleSettings
{
/// <summary>
/// The expression according to which requests should be filtered.
/// </summary>
public string Expression { get; set; }
/// <summary>
/// The filter result to be used when the <see cref="Expression"/> matches.
/// </summary>
public FilterResult Result { get; set; }
/// <summary>
/// The filter type which defines how the <see cref="Expression"/> is processed.
/// </summary>
public FilterRuleType Type { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser.Filter
{
/// <summary>
/// Defines all possible filter rule types.
/// </summary>
public enum FilterRuleType
{
/// <summary>
/// The filter rule is based on a regular expression.
/// </summary>
Regex,
/// <summary>
/// The filter rule is based on a simplified expression with wildcards.
/// </summary>
Simplified
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
using SafeExamBrowser.Settings.Browser.Filter;
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines all settings for the request filter of the browser.
/// </summary>
[Serializable]
public class FilterSettings
{
/// <summary>
/// Defines whether content requests for a web page should be filtered according to the defined <see cref="Rules"/>.
/// </summary>
public bool ProcessContentRequests { get; set; }
/// <summary>
/// Defines whether the main request for a web page should be filtered according to the defined <see cref="Rules"/>.
/// </summary>
public bool ProcessMainRequests { get; set; }
/// <summary>
/// Defines all rules to be used to filter web requests.
/// </summary>
public IList<FilterRuleSettings> Rules { get; set; }
public FilterSettings()
{
Rules = new List<FilterRuleSettings>();
}
}
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines all policies for browser window popups.
/// </summary>
public enum PopupPolicy
{
/// <summary>
/// Allows all popups.
/// </summary>
Allow,
/// <summary>
/// Allows only popups which target the same host as the window from which they originate.
/// </summary>
AllowSameHost,
/// <summary>
/// Allows only popups which target the same host as the window from which they originate and opens every request directly in the respective window.
/// </summary>
AllowSameHostAndWindow,
/// <summary>
/// Allows all popups but opens every request directly in the window from which it originates.
/// </summary>
AllowSameWindow,
/// <summary>
/// Blocks all popups.
/// </summary>
Block
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Browser.Proxy
{
/// <summary>
/// Defines the configuration of a proxy server.
/// </summary>
[Serializable]
public class ProxyConfiguration
{
/// <summary>
/// The host name or IP address of the proxy server.
/// </summary>
public string Host { get; set; }
/// <summary>
/// The password to be used for authentication.
/// </summary>
public string Password { get; set; }
/// <summary>
/// The port of the proxy server.
/// </summary>
public int Port { get; set; }
/// <summary>
/// The protocol of the proxy server.
/// </summary>
public ProxyProtocol Protocol { get; set; }
/// <summary>
/// Determines whether the proxy server requires authentication.
/// </summary>
public bool RequiresAuthentication { get; set; }
/// <summary>
/// The username to be used for authentication.
/// </summary>
public string Username { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser.Proxy
{
/// <summary>
/// Defines all currently supported proxy policies for the browser.
/// </summary>
public enum ProxyPolicy
{
/// <summary>
/// Use custom proxy settings as defined in <see cref="ProxySettings"/>.
/// </summary>
Custom,
/// <summary>
/// Use the proxy settings of the operating system (i.e. ignore all custom settings defined in <see cref="ProxySettings"/>).
/// </summary>
System
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser.Proxy
{
/// <summary>
/// Defines all protocols currently supported for proxies.
/// </summary>
public enum ProxyProtocol
{
Ftp,
Http,
Https,
Socks
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
using SafeExamBrowser.Settings.Browser.Proxy;
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines the proxy settings for the browser engine.
/// </summary>
[Serializable]
public class ProxySettings
{
/// <summary>
/// Determines whether proxy auto-configuration should be used. Requires a valid URL defined in <see cref="AutoConfigureUrl"/>.
/// </summary>
public bool AutoConfigure { get; set; }
/// <summary>
/// A valid URL to a proxy auto-configuration file (.pac). Is only evaluated if <see cref="AutoConfigure"/> is enabled.
/// </summary>
public string AutoConfigureUrl { get; set; }
/// <summary>
/// Forces proxy auto-detection by the browser engine.
/// </summary>
public bool AutoDetect { get; set; }
/// <summary>
/// A list of hosts for which all proxy settings should be bypassed.
/// </summary>
public IList<string> BypassList { get; set; }
/// <summary>
/// The proxy policy to be used.
/// </summary>
public ProxyPolicy Policy { get; set; }
/// <summary>
/// Defines all proxies to be used.
/// </summary>
public IList<ProxyConfiguration> Proxies { get; set; }
public ProxySettings()
{
BypassList = new List<string>();
Proxies = new List<ProxyConfiguration>();
}
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines all policies for handling of URLs in the user interface and log.
/// </summary>
public enum UrlPolicy
{
/// <summary>
/// Always show the URL of a resource instead of the title. Log URLs normally.
/// </summary>
Always,
/// <summary>
/// Show the URL until the title of a resource is available. Log URLs normally.
/// </summary>
BeforeTitle,
/// <summary>
/// Only show the URL on load errors, otherwise show the title of a resource. Only log URLs in error messages.
/// </summary>
LoadError,
/// <summary>
/// Never show the URL of a resource and do not log any URLs.
/// </summary>
Never
}
public static class UrlPolicyExtensions
{
/// <summary>
/// Indicates whether URLs may be logged normally.
/// </summary>
public static bool CanLog(this UrlPolicy policy)
{
return policy == UrlPolicy.Always || policy == UrlPolicy.BeforeTitle;
}
/// <summary>
/// Indicates whether URLs may be logged in case of an error.
/// </summary>
public static bool CanLogError(this UrlPolicy policy)
{
return policy.CanLog() || policy == UrlPolicy.LoadError;
}
}
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines the initial position of a browser window.
/// </summary>
public enum WindowPosition
{
Left,
Center,
Right
}
}

View File

@@ -0,0 +1,99 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Browser
{
/// <summary>
/// Defines all settings for a window of the browser engine.
/// </summary>
[Serializable]
public class WindowSettings
{
/// <summary>
/// Optionally defines the height of the browser window in physical pixels.
/// </summary>
public int? AbsoluteHeight { get; set; }
/// <summary>
/// Optionally defines the width of the browser window in physical pixels.
/// </summary>
public int? AbsoluteWidth { get; set; }
/// <summary>
/// Determines whether the user will be allowed to change the URL in the address bar.
/// </summary>
public bool AllowAddressBar { get; set; }
/// <summary>
/// Determines whether the user will be allowed to navigate backwards.
/// </summary>
public bool AllowBackwardNavigation { get; set; }
/// <summary>
/// Determines whether the user will be allowed to open the developer console.
/// </summary>
public bool AllowDeveloperConsole { get; set; }
/// <summary>
/// Determines whether the user will be allowed to navigate forwards.
/// </summary>
public bool AllowForwardNavigation { get; set; }
/// <summary>
/// Determines whether the user will be allowed to reload webpages.
/// </summary>
public bool AllowReloading { get; set; }
/// <summary>
/// Determines whether the browser window will be rendered in fullscreen mode, i.e. without window frame.
/// </summary>
public bool FullScreenMode { get; set; }
/// <summary>
/// Determines the initial position of the browser window (if it is not maximized).
/// </summary>
public WindowPosition Position { get; set; }
/// <summary>
/// Optionally defines the height of the browser window as percentage of the working area height.
/// </summary>
public int? RelativeHeight { get; set; }
/// <summary>
/// Optionally defines the width of the browser window as percentage of the working area width.
/// </summary>
public int? RelativeWidth { get; set; }
/// <summary>
/// Determines whether the home button is visible.
/// </summary>
public bool ShowHomeButton { get; set; }
/// <summary>
/// Determines whether the reload button is visible.
/// </summary>
public bool ShowReloadButton { get; set; }
/// <summary>
/// Determines whether the user will need to confirm every reload attempt.
/// </summary>
public bool ShowReloadWarning { get; set; }
/// <summary>
/// Determines whether the window toolbar is visible.
/// </summary>
public bool ShowToolbar { get; set; }
/// <summary>
/// Determines how URLs are handled in the user interface and log.
/// </summary>
public UrlPolicy UrlPolicy { get; set; }
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings
{
/// <summary>
/// Defines all possible configuration modes for the application.
/// </summary>
public enum ConfigurationMode
{
/// <summary>
/// In this mode, the application settings shall be used to configure the local client settings of a user. When running in this
/// mode, the user has the possiblity to re-configure the application during runtime.
/// </summary>
ConfigureClient,
/// <summary>
/// In this mode, the application settings shall only be used to start an exam. When running in this mode, the user cannot re-
/// configure the application during runtime.
/// </summary>
Exam
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Logging
{
/// <summary>
/// Defines all log levels supported by the application.
/// </summary>
public enum LogLevel
{
/// <summary>
/// All messages are logged.
/// </summary>
Debug,
/// <summary>
/// Only messages with <see cref="Info"/>, <see cref="Warning"/> and <see cref="Error"/> are logged.
/// </summary>
Info,
/// <summary>
/// Only messages with <see cref="Warning"/> and <see cref="Error"/> are logged.
/// </summary>
Warning,
/// <summary>
/// Only messages with <see cref="Error"/> are logged.
/// </summary>
Error
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Monitoring
{
/// <summary>
/// Defines all settings related to the display configuration monitoring.
/// </summary>
[Serializable]
public class DisplaySettings
{
/// <summary>
/// Defines the number of allowed displays.
/// </summary>
public int AllowedDisplays { get; set; }
/// <summary>
/// Determines whether the display(s) will remain always on or not. This does not prevent the operating system from entering sleep mode or
/// standby, see <see cref="System.SystemSettings.AlwaysOn"/>.
/// </summary>
public bool AlwaysOn { get; set; }
/// <summary>
/// Determines whether any display configuration may be allowed when the configuration can't be verified due to an error.
/// </summary>
public bool IgnoreError { get; set; }
/// <summary>
/// Determines whether only an internal display may be used.
/// </summary>
public bool InternalDisplayOnly { get; set; }
}
}

View File

@@ -0,0 +1,129 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Monitoring
{
/// <summary>
/// Defines all settings for monitoring keyboard input.
/// </summary>
[Serializable]
public class KeyboardSettings
{
/// <summary>
/// Determines whether the user may use the ALT+ESC shortcut.
/// </summary>
public bool AllowAltEsc { get; set; }
/// <summary>
/// Determines whether the user may use the ALT+F4 shortcut.
/// </summary>
public bool AllowAltF4 { get; set; }
/// <summary>
/// Determines whether the user may use the ALT+TAB shortcut.
/// </summary>
public bool AllowAltTab { get; set; }
/// <summary>
/// Determines whether the user may use the CTRL+C shortcut.
/// </summary>
public bool AllowCtrlC { get; set; }
/// <summary>
/// Determines whether the user may use the CTRL+ESC shortcut.
/// </summary>
public bool AllowCtrlEsc { get; set; }
/// <summary>
/// Determines whether the user may use the CTRL+V shortcut.
/// </summary>
public bool AllowCtrlV { get; set; }
/// <summary>
/// Determines whether the user may use the CTRL+X shortcut.
/// </summary>
public bool AllowCtrlX { get; set; }
/// <summary>
/// Determines whether the user may use the escape key.
/// </summary>
public bool AllowEsc { get; set; }
/// <summary>
/// Determines whether the user may use the F1 key.
/// </summary>
public bool AllowF1 { get; set; }
/// <summary>
/// Determines whether the user may use the F2 key.
/// </summary>
public bool AllowF2 { get; set; }
/// <summary>
/// Determines whether the user may use the F3 key.
/// </summary>
public bool AllowF3 { get; set; }
/// <summary>
/// Determines whether the user may use the F4 key.
/// </summary>
public bool AllowF4 { get; set; }
/// <summary>
/// Determines whether the user may use the F5 key.
/// </summary>
public bool AllowF5 { get; set; }
/// <summary>
/// Determines whether the user may use the F6 key.
/// </summary>
public bool AllowF6 { get; set; }
/// <summary>
/// Determines whether the user may use the F7 key.
/// </summary>
public bool AllowF7 { get; set; }
/// <summary>
/// Determines whether the user may use the F8 key.
/// </summary>
public bool AllowF8 { get; set; }
/// <summary>
/// Determines whether the user may use the F9 key.
/// </summary>
public bool AllowF9 { get; set; }
/// <summary>
/// Determines whether the user may use the F10 key.
/// </summary>
public bool AllowF10 { get; set; }
/// <summary>
/// Determines whether the user may use the F11 key.
/// </summary>
public bool AllowF11 { get; set; }
/// <summary>
/// Determines whether the user may use the F12 key.
/// </summary>
public bool AllowF12 { get; set; }
/// <summary>
/// Determines whether the user may use the print screen key.
/// </summary>
public bool AllowPrintScreen { get; set; }
/// <summary>
/// Determines whether the user may use the system key.
/// </summary>
public bool AllowSystemKey { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Monitoring
{
/// <summary>
/// Defines all settings for monitoring mouse input.
/// </summary>
[Serializable]
public class MouseSettings
{
/// <summary>
/// Determines whether the user may use the middle mouse button.
/// </summary>
public bool AllowMiddleButton { get; set; }
/// <summary>
/// Determines whether the user may use the right mouse button.
/// </summary>
public bool AllowRightButton { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Proctoring
{
/// <summary>
/// Defines all possible image formats for the screen proctoring.
/// </summary>
public enum ImageFormat
{
/// <summary>
/// An image with the Windows Bitmap format.
/// </summary>
Bmp,
/// <summary>
/// An image with the Graphics Interchange Format format.
/// </summary>
Gif,
/// <summary>
/// An image with the Joint Photographic Experts Group format.
/// </summary>
Jpg,
/// <summary>
/// An image with the Portable Network Graphics format.
/// </summary>
Png
}
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Proctoring
{
/// <summary>
/// Defines all possible image quantization algorithms for the screen proctoring.
/// </summary>
public enum ImageQuantization
{
/// <summary>
/// Reduces an image to a black and white image with 1 bit per pixel.
/// </summary>
BlackAndWhite1bpp,
/// <summary>
/// Reduces an image to a colored image with 8 bits per pixel (256 colors).
/// </summary>
Color8bpp,
/// <summary>
/// Reduces an image to a colored image with 16 bits per pixel (5 bits per color and the remaining bit unused, thus 32'768 colors).
/// </summary>
Color16bpp,
/// <summary>
/// Reduces an image to a colored image with 24 bits per pixel (16'777'216 colors).
/// </summary>
Color24bpp,
/// <summary>
/// Reduces an image to a grayscale image with 2 bits per pixel (4 shades).
/// </summary>
Grayscale2bpp,
/// <summary>
/// Reduces an image to a grayscale image with 4 bits per pixel (16 shades).
/// </summary>
Grayscale4bpp,
/// <summary>
/// Reduces an image to a grayscale image with 8 bits per pixel (256 shades).
/// </summary>
Grayscale8bpp
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Proctoring
{
/// <summary>
/// All settings related to the metadata capturing of the screen proctoring.
/// </summary>
[Serializable]
public class MetaDataSettings
{
/// <summary>
/// Determines whether data of the active application shall be captured and transmitted.
/// </summary>
public bool CaptureApplicationData { get; set; }
/// <summary>
/// Determines whether data of the browser application shall be captured and transmitted.
/// </summary>
public bool CaptureBrowserData { get; set; }
/// <summary>
/// Determines whether the title of the currently active window shall be captured and transmitted.
/// </summary>
public bool CaptureWindowTitle { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Proctoring
{
/// <summary>
/// Defines all settings related to remote proctoring.
/// </summary>
[Serializable]
public class ProctoringSettings
{
/// <summary>
/// Determines whether the entire remote proctoring feature is enabled.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Determines whether the message input for the raise hand notification will be forced.
/// </summary>
public bool ForceRaiseHandMessage { get; set; }
/// <summary>
/// All settings for the screen proctoring.
/// </summary>
public ScreenProctoringSettings ScreenProctoring { get; set; }
/// <summary>
/// Determines whether the raise hand notification will be shown in the shell.
/// </summary>
public bool ShowRaiseHandNotification { get; set; }
/// <summary>
/// Determines whether the proctoring notification will be shown in the taskbar.
/// </summary>
public bool ShowTaskbarNotification { get; set; }
public ProctoringSettings()
{
ScreenProctoring = new ScreenProctoringSettings();
}
}
}

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Proctoring
{
/// <summary>
/// All settings for the screen proctoring.
/// </summary>
[Serializable]
public class ScreenProctoringSettings
{
/// <summary>
/// The client identifier used for authentication with the screen proctoring service.
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// The client secret used for authentication with the screen proctoring service.
/// </summary>
public string ClientSecret { get; set; }
/// <summary>
/// Determines whether the screen proctoring is enabled.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// The identifier of the group to which the user belongs.
/// </summary>
public string GroupId { get; set; }
/// <summary>
/// Defines the factor to be used for downscaling of the screen shots.
/// </summary>
public double ImageDownscaling { get; set; }
/// <summary>
/// Defines the image format to be used for the screen shots.
/// </summary>
public ImageFormat ImageFormat { get; set; }
/// <summary>
/// Defines the algorithm to be used for quantization of the screen shots.
/// </summary>
public ImageQuantization ImageQuantization { get; set; }
/// <summary>
/// The maximum time interval in milliseconds between screen shot transmissions.
/// </summary>
public int MaxInterval { get; set; }
/// <summary>
/// All settings related to the metadata capturing of the screen proctoring.
/// </summary>
public MetaDataSettings MetaData { get; set; }
/// <summary>
/// The minimum time interval in milliseconds between screen shot transmissions.
/// </summary>
public int MinInterval { get; set; }
/// <summary>
/// The URL of the screen proctoring service.
/// </summary>
public string ServiceUrl { get; set; }
public ScreenProctoringSettings()
{
MetaData = new MetaDataSettings();
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SafeExamBrowser.Settings")]
[assembly: AssemblyDescription("Safe Exam Browser")]
[assembly: AssemblyCompany("ETH Zürich")]
[assembly: AssemblyProduct("SafeExamBrowser.Settings")]
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("30b2d907-5861-4f39-abad-c4abf1b3470e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{30B2D907-5861-4F39-ABAD-C4ABF1B3470E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SafeExamBrowser.Settings</RootNamespace>
<AssemblyName>SafeExamBrowser.Settings</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="Applications\ApplicationSettings.cs" />
<Compile Include="Applications\BlacklistApplication.cs" />
<Compile Include="Applications\WhitelistApplication.cs" />
<Compile Include="Browser\FilterSettings.cs" />
<Compile Include="Browser\BrowserSettings.cs" />
<Compile Include="Browser\UrlPolicy.cs" />
<Compile Include="Browser\WindowPosition.cs" />
<Compile Include="Browser\WindowSettings.cs" />
<Compile Include="Browser\Filter\FilterResult.cs" />
<Compile Include="Browser\Filter\FilterRuleSettings.cs" />
<Compile Include="Browser\Filter\FilterRuleType.cs" />
<Compile Include="Browser\PopupPolicy.cs" />
<Compile Include="Browser\Proxy\ProxyPolicy.cs" />
<Compile Include="Browser\ProxySettings.cs" />
<Compile Include="Browser\Proxy\ProxyProtocol.cs" />
<Compile Include="Browser\Proxy\ProxyConfiguration.cs" />
<Compile Include="ConfigurationMode.cs" />
<Compile Include="Monitoring\DisplaySettings.cs" />
<Compile Include="Proctoring\ImageFormat.cs" />
<Compile Include="Proctoring\ImageQuantization.cs" />
<Compile Include="Proctoring\MetaDataSettings.cs" />
<Compile Include="Proctoring\ProctoringSettings.cs" />
<Compile Include="Proctoring\ScreenProctoringSettings.cs" />
<Compile Include="Security\ClipboardPolicy.cs" />
<Compile Include="Security\VersionRestriction.cs" />
<Compile Include="SessionMode.cs" />
<Compile Include="Security\KioskMode.cs" />
<Compile Include="Logging\LogLevel.cs" />
<Compile Include="Monitoring\KeyboardSettings.cs" />
<Compile Include="Monitoring\MouseSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Security\SecuritySettings.cs" />
<Compile Include="Security\VirtualMachinePolicy.cs" />
<Compile Include="Server\ServerSettings.cs" />
<Compile Include="Service\ServicePolicy.cs" />
<Compile Include="Service\ServiceSettings.cs" />
<Compile Include="AppSettings.cs" />
<Compile Include="SystemComponents\AudioSettings.cs" />
<Compile Include="SystemComponents\PowerSupplySettings.cs" />
<Compile Include="System\SystemSettings.cs" />
<Compile Include="UserInterface\ActionCenterSettings.cs" />
<Compile Include="UserInterface\LockScreenSettings.cs" />
<Compile Include="UserInterface\TaskbarSettings.cs" />
<Compile Include="UserInterface\UserInterfaceMode.cs" />
<Compile Include="UserInterface\UserInterfaceSettings.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Security
{
/// <summary>
/// Defines all policies with respect to the usage of the clipboard.
/// </summary>
public enum ClipboardPolicy
{
/// <summary>
/// Allows the usage of the system clipboard without restrictions.
/// </summary>
Allow,
/// <summary>
/// Completely blocks the usage of the system clipboard by continuously clearing its content and blocking all related keyboard shortcuts.
/// </summary>
Block,
/// <summary>
/// Continuously clears the content of the system clipboard and enables an isolated clipboard only working within the browser application.
/// </summary>
Isolated
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Security
{
/// <summary>
/// Defines all kiosk modes which SEB supports.
/// </summary>
public enum KioskMode
{
/// <summary>
/// No kiosk mode - should only be used for testing / debugging.
/// </summary>
None,
/// <summary>
/// Creates a new desktop and runs the client on it, without modifying the default desktop.
/// </summary>
CreateNewDesktop,
/// <summary>
/// Terminates the Windows explorer shell and runs the client on the default desktop.
/// </summary>
DisableExplorerShell
}
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
namespace SafeExamBrowser.Settings.Security
{
/// <summary>
/// Defines all settings related to security.
/// </summary>
[Serializable]
public class SecuritySettings
{
/// <summary>
/// The hash code of the administrator password for the settings.
/// </summary>
public string AdminPasswordHash { get; set; }
/// <summary>
/// Determines whether any log information will be accessible via the user interface.
/// </summary>
public bool AllowApplicationLogAccess { get; set; }
/// <summary>
/// Determines whether the user may initiate the termination of SEB. This setting does not affect automated mechanisms like a quit URL.
/// </summary>
public bool AllowTermination { get; set; }
/// <summary>
/// Determines whether the user may reconfigure the application.
/// </summary>
public bool AllowReconfiguration { get; set; }
/// <summary>
/// Determines whether the user may use the sticky keys feature of the operating system.
/// </summary>
public bool AllowStickyKeys { get; set; }
/// <summary>
/// Determines whether the user is allowed to use the system clipboard, a custom clipboard or no clipboard at all.
/// </summary>
public ClipboardPolicy ClipboardPolicy { get; set; }
/// <summary>
/// Determines whether the lock screen is disabled in case of a user session change. This setting overrides the activation based on
/// <see cref="Service.ServiceSettings.IgnoreService"/> and <see cref="Service.ServiceSettings.DisableUserLock"/> or <see cref="Service.ServiceSettings.DisableUserSwitch"/>.
/// </summary>
public bool DisableSessionChangeLockScreen { get; set; }
/// <summary>
/// The kiosk mode which determines how the computer is locked down.
/// </summary>
public KioskMode KioskMode { get; set; }
/// <summary>
/// The hash code of the quit password.
/// </summary>
public string QuitPasswordHash { get; set; }
/// <summary>
/// An URL to optionally restrict with which resource SEB may be reconfigured. Allows the usage of a wildcard character (<c>*</c>).
/// </summary>
public string ReconfigurationUrl { get; set; }
/// <summary>
/// Determines whether the cursor configuration will be verified during session initialization.
/// </summary>
public bool VerifyCursorConfiguration { get; set; }
/// <summary>
/// Determines whether the session integrity will be verified after session initialization.
/// </summary>
public bool VerifySessionIntegrity { get; set; }
/// <summary>
/// All restrictions which apply to the SEB version to be used.
/// </summary>
public IList<VersionRestriction> VersionRestrictions { get; set; }
/// <summary>
/// Determines whether SEB is allowed to run in a virtual machine.
/// </summary>
public VirtualMachinePolicy VirtualMachinePolicy { get; set; }
public SecuritySettings()
{
VersionRestrictions = new List<VersionRestriction>();
}
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Security
{
/// <summary>
/// Defines a restriction for the SEB version to be used.
/// </summary>
[Serializable]
public class VersionRestriction
{
/// <summary>
/// The major version to be used.
/// </summary>
public int Major { get; set; }
/// <summary>
/// The minor version to be used.
/// </summary>
public int Minor { get; set; }
/// <summary>
/// Optionally defines the patch version to be used.
/// </summary>
public int? Patch { get; set; }
/// <summary>
/// Optionally defines the build version to be used.
/// </summary>
public int? Build { get; set; }
/// <summary>
/// Determines whether the restriction defines the minimum version to be used.
/// </summary>
public bool IsMinimumRestriction { get; set; }
/// <summary>
/// Determines whether the restriction requires the usage of the Alliance Edition.
/// </summary>
public bool RequiresAllianceEdition { get; set; }
public override string ToString()
{
return $"{Major}.{Minor}{(Patch.HasValue ? $".{Patch}" : "")}{(Build.HasValue ? $".{Build}" : "")}{(RequiresAllianceEdition ? ".AE" : "")}{(IsMinimumRestriction ? ".min" : "")}";
}
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Security
{
/// <summary>
/// Defines all policies with respect to running SEB in a virtual machine.
/// </summary>
public enum VirtualMachinePolicy
{
/// <summary>
/// SEB is allowed to be run in a virtual machine.
/// </summary>
Allow,
/// <summary>
/// SEB is not allowed to be run in a virtual machine.
/// </summary>
Deny
}
}

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.Server
{
/// <summary>
/// Defines all settings for a SEB server.
/// </summary>
[Serializable]
public class ServerSettings
{
/// <summary>
/// The discovery URL for the API of the server.
/// </summary>
public string ApiUrl { get; set; }
/// <summary>
/// The client name for initial authentication with the server.
/// </summary>
public string ClientName { get; set; }
/// <summary>
/// The client secret for initial authentication with the server.
/// </summary>
public string ClientSecret { get; set; }
/// <summary>
/// The identifier of the exam to be started. If present, the exam will be automatically started, i.e. the exam selection will be skipped.
/// </summary>
public string ExamId { get; set; }
/// <summary>
/// The hash code of the password required to perform a fallback.
/// </summary>
public string FallbackPasswordHash { get; set; }
/// <summary>
/// The institution to be used for identification with the server.
/// </summary>
public string Institution { get; set; }
/// <summary>
/// Indicates whether SEB will fallback to the start URL in case no connection could be established with the server.
/// </summary>
public bool PerformFallback { get; set; }
/// <summary>
/// The time interval in milliseconds to be used for ping requests.
/// </summary>
public int PingInterval { get; set; }
/// <summary>
/// The number of attempts (e.g. when receiving an invalid server response) before performing a fallback or failing.
/// </summary>
public int RequestAttempts { get; set; }
/// <summary>
/// The time interval in milliseconds to be waited in between attempts.
/// </summary>
public int RequestAttemptInterval { get; set; }
/// <summary>
/// The timeout in milliseconds (e.g. to wait for a server response) before performing a fallback or failing.
/// </summary>
public int RequestTimeout { get; set; }
/// <summary>
/// The URL of the server.
/// </summary>
public string ServerUrl { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Service
{
/// <summary>
/// Defines all possible service policies which the application supports.
/// </summary>
public enum ServicePolicy
{
/// <summary>
/// The service component must be running. If it is not running, the user won't be able to start the application.
/// </summary>
Mandatory,
/// <summary>
/// The service component is optional. If it is not running, all service-related actions are simply skipped.
/// </summary>
Optional,
/// <summary>
/// The service component should be running. If it is not running, the user will be warned that all service-related actions are skipped.
/// </summary>
Warn
}
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.Service
{
/// <summary>
/// Defines all settings for the service application component.
/// </summary>
public class ServiceSettings
{
/// <summary>
/// Determines whether desktop notifications of Google Chrome should be deactivated.
/// </summary>
public bool DisableChromeNotifications { get; set; }
/// <summary>
/// Determines whether the user can access the ease of access options on the security screen.
/// </summary>
public bool DisableEaseOfAccessOptions { get; set; }
/// <summary>
/// Determines whether the user can access the find printer option in the print dialog of Windows.
/// </summary>
public bool DisableFindPrinter { get; set; }
/// <summary>
/// Determines whether the user can access the network options on the security screen.
/// </summary>
public bool DisableNetworkOptions { get; set; }
/// <summary>
/// Determines whether the user can change the password for a user account via the security screen.
/// </summary>
public bool DisablePasswordChange { get; set; }
/// <summary>
/// Determines whether the user can access the power options on the security screen.
/// </summary>
public bool DisablePowerOptions { get; set; }
/// <summary>
/// Determines whether remote desktop connections should be deactivated.
/// </summary>
public bool DisableRemoteConnections { get; set; }
/// <summary>
/// Determines whether the user can sign out of their account via the security screen.
/// </summary>
public bool DisableSignout { get; set; }
/// <summary>
/// Determines whether the user can access the task manager of Windows.
/// </summary>
public bool DisableTaskManager { get; set; }
/// <summary>
/// Determines whether the user can lock the computer via the security screen.
/// </summary>
public bool DisableUserLock { get; set; }
/// <summary>
/// Determines whether the user can switch to another user account via the security screen.
/// </summary>
public bool DisableUserSwitch { get; set; }
/// <summary>
/// Determines whether the user interface overlay for VMware clients should be deactivated.
/// </summary>
public bool DisableVmwareOverlay { get; set; }
/// <summary>
/// Determines whether Windows Update should be deactivated.
/// </summary>
public bool DisableWindowsUpdate { get; set; }
/// <summary>
/// Determines whether the service will be completely ignored, i.e. no actions will be performed by the service component.
/// </summary>
public bool IgnoreService { get; set; }
/// <summary>
/// The active policy for the service component. Has no effect if <see cref="IgnoreService"/> is set to <c>true</c>.
/// </summary>
public ServicePolicy Policy { get; set; }
/// <summary>
/// Determines whether the VMware configuration will be set by the service.
/// </summary>
public bool SetVmwareConfiguration { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings
{
/// <summary>
/// Defines all possible session modes.
/// </summary>
public enum SessionMode
{
/// <summary>
/// SEB will start a normal session without SEB server.
/// </summary>
Normal,
/// <summary>
/// SEB will start a session with SEB server.
/// </summary>
Server
}
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.System
{
/// <summary>
/// Defines all settings related to functionality of the operating system.
/// </summary>
[Serializable]
public class SystemSettings
{
/// <summary>
/// Determines whether the system will remain always on or not (i.e. potentially entering sleep mode or standby). This does not prevent the
/// display(s) from turning off, see <see cref="Monitoring.DisplaySettings.AlwaysOn"/>.
/// </summary>
public bool AlwaysOn { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.SystemComponents
{
/// <summary>
/// Defines all settings for the audio device of the computer.
/// </summary>
[Serializable]
public class AudioSettings
{
/// <summary>
/// Defines whether the audio volume should be initialized to the value of <see cref="InitialVolume"/> during application startup.
/// </summary>
public bool InitializeVolume { get; set; }
/// <summary>
/// Defines the initial audio volume (from 0 to 100) to be used if <see cref="InitializeVolume"/> is active.
/// </summary>
public int InitialVolume { get; set; }
/// <summary>
/// Defines whether the audio device should be muted during application startup.
/// </summary>
public bool MuteAudio { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.SystemComponents
{
/// <summary>
/// Defines all settings for the power supply system component.
/// </summary>
[Serializable]
public class PowerSupplySettings
{
/// <summary>
/// The threshold below which the charge of the power supply is to be considered critical.
/// </summary>
public double ChargeThresholdCritical { get; set; }
/// <summary>
/// The threshold below which the charge of the power supply is to be considered low.
/// </summary>
public double ChargeThresholdLow { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.UserInterface
{
/// <summary>
/// Defines all settings for the action center.
/// </summary>
[Serializable]
public class ActionCenterSettings
{
/// <summary>
/// Determines whether the action center itself is enabled and visible to the user.
/// </summary>
public bool EnableActionCenter { get; set; }
/// <summary>
/// Determines whether the about window is accessible via the action center.
/// </summary>
public bool ShowApplicationInfo { get; set; }
/// <summary>
/// Determines whether the application log is accessible via the action center.
/// </summary>
public bool ShowApplicationLog { get; set; }
/// <summary>
/// Determines whether the system control for audio is accessible via the action center.
/// </summary>
public bool ShowAudio { get; set; }
/// <summary>
/// Determines whether the current date and time will be rendered in the action center.
/// </summary>
public bool ShowClock { get; set; }
/// <summary>
/// Determines whether the system control for the keyboard layout is accessible via the action center.
/// </summary>
public bool ShowKeyboardLayout { get; set; }
/// <summary>
/// Determines whether the system control for the network is accessible via the action center.
/// </summary>
public bool ShowNetwork { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.UserInterface
{
/// <summary>
/// Defines all settings for the lock screen.
/// </summary>
[Serializable]
public class LockScreenSettings
{
/// <summary>
/// The background color as hexadecimal color code.
/// </summary>
public string BackgroundColor { get; set; }
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.UserInterface
{
/// <summary>
/// Defines all settings for the taskbar.
/// </summary>
[Serializable]
public class TaskbarSettings
{
/// <summary>
/// Determines whether the taskbar itself is enabled and visible to the user.
/// </summary>
public bool EnableTaskbar { get; set; }
/// <summary>
/// Determines whether the about window is accessible via the taskbar.
/// </summary>
public bool ShowApplicationInfo { get; set; }
/// <summary>
/// Determines whether the application log is accessible via the taskbar.
/// </summary>
public bool ShowApplicationLog { get; set; }
/// <summary>
/// Determines whether the system control for audio is accessible via the taskbar.
/// </summary>
public bool ShowAudio { get; set; }
/// <summary>
/// Determines whether the current date and time will be rendered in the taskbar.
/// </summary>
public bool ShowClock { get; set; }
/// <summary>
/// Determines whether the system control for the keyboard layout is accessible via the taskbar.
/// </summary>
public bool ShowKeyboardLayout { get; set; }
/// <summary>
/// Determines whether the system control for the network is accessible via the taskbar.
/// </summary>
public bool ShowNetwork { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.Settings.UserInterface
{
/// <summary>
/// Defines all possible look &amp; feel options for the application.
/// </summary>
public enum UserInterfaceMode
{
/// <summary>
/// In this mode, the user interface is optimized for desktop computers with keyboard and mouse.
/// </summary>
Desktop,
/// <summary>
/// In this mode, the user interface is optimized for mobile computers with touch capability.
/// </summary>
Mobile
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
namespace SafeExamBrowser.Settings.UserInterface
{
/// <summary>
/// Defines all settings for the user interface.
/// </summary>
[Serializable]
public class UserInterfaceSettings
{
/// <summary>
/// All settings related to the action center.
/// </summary>
public ActionCenterSettings ActionCenter { get; set; }
/// <summary>
/// All settings related to the lock screen.
/// </summary>
public LockScreenSettings LockScreen { get; set; }
/// <summary>
/// The mode which determines the look &amp; feel of the user interface.
/// </summary>
public UserInterfaceMode Mode { get; set; }
/// <summary>
/// All taskbar-related settings.
/// </summary>
public TaskbarSettings Taskbar { get; set; }
public UserInterfaceSettings()
{
ActionCenter = new ActionCenterSettings();
LockScreen = new LockScreenSettings();
Taskbar = new TaskbarSettings();
}
}
}