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,43 @@
/*
* 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.Communication.Contracts.Proxies
{
/// <summary>
/// Defines the result of a communication between an <see cref="ICommunicationProxy"/> and its <see cref="ICommunicationHost"/>.
/// </summary>
public class CommunicationResult
{
/// <summary>
/// Defines whether the communication was successful or not.
/// </summary>
public bool Success { get; protected set; }
public CommunicationResult(bool success)
{
Success = success;
}
}
/// <summary>
/// Defines the result of a communication between an <see cref="ICommunicationProxy"/> and its <see cref="ICommunicationHost"/>.
/// </summary>
/// <typeparam name="T">The type of the expected response value.</typeparam>
public class CommunicationResult<T> : CommunicationResult
{
/// <summary>
/// The response value. Can be <c>null</c> or <c>default(T)</c> in case the communication has failed!
/// </summary>
public T Value { get; protected set; }
public CommunicationResult(bool success, T value) : base(success)
{
Value = value;
}
}
}

View File

@@ -0,0 +1,60 @@
/*
* 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.Communication.Contracts.Data;
namespace SafeExamBrowser.Communication.Contracts.Proxies
{
/// <summary>
/// Defines the functionality for a proxy to the communication host of the client application component.
/// </summary>
public interface IClientProxy : ICommunicationProxy
{
/// <summary>
/// Informs the client that a reconfiguration was aborted.
/// </summary>
CommunicationResult InformReconfigurationAborted();
/// <summary>
/// Informs the client that the reconfiguration request for the specified file was denied.
/// </summary>
CommunicationResult InformReconfigurationDenied(string filePath);
/// <summary>
/// Instructs the client to initiate its shutdown procedure.
/// </summary>
CommunicationResult InitiateShutdown();
/// <summary>
/// Instructs the client to submit its authentication data.
/// </summary>
CommunicationResult<AuthenticationResponse> RequestAuthentication();
/// <summary>
/// Requests the client to render a server exam selection dialog and subsequently return the interaction result as separate message.
/// </summary>
CommunicationResult RequestExamSelection(IEnumerable<(string id, string lms, string name, string url)> exams, Guid requestId);
/// <summary>
/// Requests the client to render a password dialog and subsequently return the interaction result as separate message.
/// </summary>
CommunicationResult RequestPassword(PasswordRequestPurpose purpose, Guid requestId);
/// <summary>
/// Requests the client to render a server failure action dialog and subsequently return the interaction result as separate message.
/// </summary>
CommunicationResult RequestServerFailureAction(string message, bool showFallback, Guid requestId);
/// <summary>
/// Requests the client to render a message box and subsequently return the interaction result as separate message.
/// </summary>
CommunicationResult ShowMessage(string message, string title, int action, int icon, Guid requestId);
}
}

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.Communication.Contracts.Proxies
{
/// <summary>
/// A factory to create communication proxies during application runtime.
/// </summary>
public interface IProxyFactory
{
/// <summary>
/// Creates a new <see cref="IClientProxy"/> for the given endpoint address and owner.
/// </summary>
IClientProxy CreateClientProxy(string address, Interlocutor owner);
}
}

View File

@@ -0,0 +1,19 @@
/*
* 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.ServiceModel;
namespace SafeExamBrowser.Communication.Contracts.Proxies
{
/// <summary>
/// The communication object to be used in an <see cref="ICommunicationProxy"/>.
/// </summary>
public interface IProxyObject : ICommunication, ICommunicationObject
{
}
}

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.Communication.Contracts.Proxies
{
/// <summary>
/// A factory to create proxy objects for communication proxies.
/// </summary>
public interface IProxyObjectFactory
{
/// <summary>
/// Creates a proxy object (see <see cref="IProxyObject"/>) for the specified endpoint address.
/// </summary>
IProxyObject CreateObject(string address);
}
}

View File

@@ -0,0 +1,61 @@
/*
* 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.Communication.Contracts.Data;
namespace SafeExamBrowser.Communication.Contracts.Proxies
{
/// <summary>
/// Defines the functionality for a proxy to the communication host of the runtime application component.
/// </summary>
public interface IRuntimeProxy : ICommunicationProxy
{
/// <summary>
/// Retrieves the application configuration from the runtime.
/// </summary>
CommunicationResult<ConfigurationResponse> GetConfiguration();
/// <summary>
/// Informs the runtime that the client is ready.
/// </summary>
CommunicationResult InformClientReady();
/// <summary>
/// Requests the runtime to shut down the application.
/// </summary>
CommunicationResult RequestShutdown();
/// <summary>
/// Requests the runtime to reconfigure the application with the specified configuration.
/// </summary>
CommunicationResult RequestReconfiguration(string filePath, string url);
/// <summary>
/// Submits the result of a server exam selection previously requested by the runtime. If the procedure was aborted by the user,
/// the selected exam identifier will be <see cref="default(string)"/>!
/// </summary>
CommunicationResult SubmitExamSelectionResult(Guid requestId, bool success, string selectedExamId = default(string));
/// <summary>
/// Submits the result of a message box input previously requested by the runtime.
/// </summary>
CommunicationResult SubmitMessageBoxResult(Guid requestId, int result);
/// <summary>
/// Submits the result of a password input previously requested by the runtime. If the procedure was aborted by the user,
/// the password parameter will be <see cref="default(string)"/>!
/// </summary>
CommunicationResult SubmitPassword(Guid requestId, bool success, string password = default(string));
/// <summary>
/// Submits the result of a server failure action selection previously requested by the runtime.
/// </summary>
CommunicationResult SubmitServerFailureActionResult(Guid requestId, bool abort, bool fallback, bool retry);
}
}

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;
using SafeExamBrowser.Configuration.Contracts;
namespace SafeExamBrowser.Communication.Contracts.Proxies
{
/// <summary>
/// Defines the functionality for a proxy to the communication host of the service application component.
/// </summary>
public interface IServiceProxy : ICommunicationProxy
{
/// <summary>
/// Instructs the service to start a system configuration update.
/// </summary>
CommunicationResult RunSystemConfigurationUpdate();
/// <summary>
/// Instructs the service to start a new session according to the given configuration.
/// </summary>
CommunicationResult StartSession(ServiceConfiguration configuration);
/// <summary>
/// Instructs the service to stop the specified session.
/// </summary>
CommunicationResult StopSession(Guid sessionId);
}
}