2017-07-28 14:52:15 +02:00
/ *
2023-03-08 00:30:20 +01:00
* Copyright ( c ) 2023 ETH Zürich , Educational Development and Technology ( LET )
2017-07-28 14:52:15 +02:00
*
* 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/.
* /
2018-02-15 15:42:54 +01:00
using System ;
2019-09-06 09:39:28 +02:00
namespace SafeExamBrowser.Settings.Browser
2017-07-28 14:52:15 +02:00
{
2018-03-06 11:38:12 +01:00
/// <summary>
2020-01-29 10:07:28 +01:00
/// Defines all settings for the integrated browser application.
2018-03-06 11:38:12 +01:00
/// </summary>
2018-02-15 15:42:54 +01:00
[Serializable]
public class BrowserSettings
2017-07-28 14:52:15 +02:00
{
/// <summary>
2019-09-10 11:53:30 +02:00
/// The settings to be used for additional browser windows.
2017-07-28 14:52:15 +02:00
/// </summary>
2019-12-18 08:24:55 +01:00
public WindowSettings AdditionalWindow { get ; set ; }
2017-07-28 14:52:15 +02:00
2018-11-08 09:39:52 +01:00
/// <summary>
2019-01-17 11:12:17 +01:00
/// Determines whether the user will be allowed to download configuration files.
2018-11-08 09:39:52 +01:00
/// </summary>
public bool AllowConfigurationDownloads { get ; set ; }
2020-01-20 16:13:08 +01:00
/// <summary>
2020-08-05 22:55:38 +02:00
/// Determines whether the user will be allowed to select a custom location when down- or uploading a file (excluding configuration files).
2020-01-20 16:13:08 +01:00
/// </summary>
2020-08-05 22:55:38 +02:00
public bool AllowCustomDownAndUploadLocation { get ; set ; }
2020-01-20 16:13:08 +01:00
2018-06-21 07:56:25 +02:00
/// <summary>
2019-01-17 11:12:17 +01:00
/// Determines whether the user will be allowed to download files (excluding configuration files).
2018-06-21 07:56:25 +02:00
/// </summary>
public bool AllowDownloads { get ; set ; }
2020-08-11 17:52:51 +02:00
/// <summary>
/// Determines whether the user will be allowed to search page contents.
/// </summary>
public bool AllowFind { get ; set ; }
2019-01-15 10:44:35 +01:00
/// <summary>
2019-01-17 11:12:17 +01:00
/// Determines whether the user will be allowed to zoom webpages.
2019-01-15 10:44:35 +01:00
/// </summary>
public bool AllowPageZoom { get ; set ; }
2020-01-30 11:15:28 +01:00
/// <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 ; }
2022-07-25 20:25:42 +02:00
/// <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 ; }
2020-03-05 09:38:26 +01:00
/// <summary>
/// Determines whether spell checking is enabled for input fields.
/// </summary>
public bool AllowSpellChecking { get ; set ; }
2020-01-24 10:19:11 +01:00
/// <summary>
/// Determines whether the user will be allowed to upload files.
/// </summary>
public bool AllowUploads { get ; set ; }
2021-10-18 12:06:10 +02:00
/// <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 ; }
2020-02-13 11:01:07 +01:00
/// <summary>
/// The configuration key used for integrity checks with server applications (see also <see cref="SendConfigurationKey"/>).
/// </summary>
public string ConfigurationKey { get ; set ; }
2019-12-19 15:02:40 +01:00
/// <summary>
/// Determines whether the user needs to confirm the termination of SEB by <see cref="QuitUrl"/>.
/// </summary>
public bool ConfirmQuitUrl { get ; set ; }
2019-01-11 08:25:40 +01:00
/// <summary>
/// The custom user agent to optionally be used for all requests.
/// </summary>
public string CustomUserAgent { get ; set ; }
2020-02-17 12:10:04 +01:00
/// <summary>
2020-02-21 15:11:35 +01:00
/// 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>!
2020-02-17 12:10:04 +01:00
/// </summary>
public bool DeleteCookiesOnShutdown { get ; set ; }
/// <summary>
/// Determines whether all cookies are deleted when starting the browser application.
/// </summary>
public bool DeleteCookiesOnStartup { get ; set ; }
2020-01-20 16:13:08 +01:00
/// <summary>
2021-07-01 18:54:43 +02:00
/// Defines a custom directory for down- and uploads. If not defined, all operations will be directed to the current user's download directory.
2020-01-20 16:13:08 +01:00
/// </summary>
2020-08-05 22:55:38 +02:00
public string DownAndUploadDirectory { get ; set ; }
2020-01-20 16:13:08 +01:00
2020-01-10 10:25:51 +01:00
/// <summary>
/// Determines whether the user is allowed to use the integrated browser application.
/// </summary>
public bool EnableBrowser { get ; set ; }
2020-01-10 08:54:10 +01:00
/// <summary>
2020-02-13 11:01:07 +01:00
/// The settings to be used for the browser request filter.
2020-01-10 08:54:10 +01:00
/// </summary>
2020-02-13 11:01:07 +01:00
public FilterSettings Filter { get ; set ; }
2020-01-10 08:54:10 +01:00
2020-10-05 23:37:23 +02:00
/// <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 ; }
2017-07-28 14:52:15 +02:00
/// <summary>
2019-09-10 11:53:30 +02:00
/// The settings to be used for the main browser window.
2017-07-28 14:52:15 +02:00
/// </summary>
2019-12-18 08:24:55 +01:00
public WindowSettings MainWindow { get ; set ; }
2019-12-12 15:41:05 +01:00
/// <summary>
/// Determines how attempts to open a popup are handled.
/// </summary>
public PopupPolicy PopupPolicy { get ; set ; }
2019-12-18 08:09:59 +01:00
/// <summary>
/// Determines the proxy settings to be used by the browser.
/// </summary>
2019-12-18 08:24:55 +01:00
public ProxySettings Proxy { get ; set ; }
2019-12-18 08:09:59 +01:00
2019-12-19 15:02:40 +01:00
/// <summary>
2020-09-21 19:22:15 +02:00
/// 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.
2019-12-19 15:02:40 +01:00
/// </summary>
public string QuitUrl { get ; set ; }
2020-09-21 19:22:15 +02:00
/// <summary>
/// Determines whether the browser should be reset when a <see cref="QuitUrl"/> is detected.
/// </summary>
public bool ResetOnQuitUrl { get ; set ; }
2020-01-10 08:54:10 +01:00
/// <summary>
2020-02-13 11:01:07 +01:00
/// Determines whether the configuration key header is sent with every HTTP request (see also <see cref="ConfigurationKey"/>).
/// </summary>
public bool SendConfigurationKey { get ; set ; }
/// <summary>
2021-10-18 12:06:10 +02:00
/// Determines whether the browser exam key header is sent with every HTTP request (see also <see cref="BrowserExamKeySalt"/>).
2020-01-10 08:54:10 +01:00
/// </summary>
2021-10-18 12:06:10 +02:00
public bool SendBrowserExamKey { get ; set ; }
2020-01-10 08:54:10 +01:00
2017-07-31 20:22:53 +02:00
/// <summary>
2019-01-23 09:37:47 +01:00
/// The URL with which the main browser window will be loaded.
2017-07-31 20:22:53 +02:00
/// </summary>
2018-02-15 15:42:54 +01:00
public string StartUrl { get ; set ; }
2019-01-11 08:25:40 +01:00
2020-09-24 12:55:20 +02:00
/// <summary>
/// A query for the <see cref="StartUrl"/> which SEB automatically extracts from the configuration URL.
/// </summary>
public string StartUrlQuery { get ; set ; }
2019-01-11 08:25:40 +01:00
/// <summary>
2019-01-17 11:12:17 +01:00
/// Determines whether a custom user agent will be used for all requests, see <see cref="CustomUserAgent"/>.
2019-01-11 08:25:40 +01:00
/// </summary>
public bool UseCustomUserAgent { get ; set ; }
2019-01-23 09:37:47 +01:00
2020-09-24 12:55:20 +02:00
/// <summary>
/// Determines whether the <see cref="StartUrlQuery"/> will be appended to the <see cref="StartUrl"/>.
/// </summary>
public bool UseQueryParameter { get ; set ; }
2021-07-01 18:54:43 +02:00
/// <summary>
/// A custom suffix to be appended to the user agent.
/// </summary>
public string UserAgentSuffix { get ; set ; }
2020-10-05 23:37:23 +02:00
/// <summary>
/// Determines whether the start URL will be used when navigating home.
/// </summary>
public bool UseStartUrlAsHomeUrl { get ; set ; }
2020-02-19 15:32:38 +01:00
/// <summary>
2021-07-01 18:54:43 +02:00
/// Determines whether a temporary directory should be used for down- and uploads.
2020-02-19 15:32:38 +01:00
/// </summary>
2021-07-01 18:54:43 +02:00
public bool UseTemporaryDownAndUploadDirectory { get ; set ; }
2020-02-19 15:32:38 +01:00
2019-01-23 09:37:47 +01:00
public BrowserSettings ( )
{
2019-12-18 08:24:55 +01:00
AdditionalWindow = new WindowSettings ( ) ;
Filter = new FilterSettings ( ) ;
MainWindow = new WindowSettings ( ) ;
Proxy = new ProxySettings ( ) ;
2019-01-23 09:37:47 +01:00
}
2017-07-28 14:52:15 +02:00
}
}