Restore SEBPatch
This commit is contained in:
33
SafeExamBrowser.Browser.Contracts/Filters/IRequestFilter.cs
Normal file
33
SafeExamBrowser.Browser.Contracts/Filters/IRequestFilter.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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 SafeExamBrowser.Settings.Browser.Filter;
|
||||
|
||||
namespace SafeExamBrowser.Browser.Contracts.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the filter for browser requests.
|
||||
/// </summary>
|
||||
public interface IRequestFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// The default result to be returned by <see cref="Process(Request)"/> if no rule matches.
|
||||
/// </summary>
|
||||
FilterResult Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the given filter rule to be used when processing requests.
|
||||
/// </summary>
|
||||
void Load(IRule rule);
|
||||
|
||||
/// <summary>
|
||||
/// Filters the given request according to the loaded rules.
|
||||
/// </summary>
|
||||
FilterResult Process(Request request);
|
||||
}
|
||||
}
|
33
SafeExamBrowser.Browser.Contracts/Filters/IRule.cs
Normal file
33
SafeExamBrowser.Browser.Contracts/Filters/IRule.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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 SafeExamBrowser.Settings.Browser.Filter;
|
||||
|
||||
namespace SafeExamBrowser.Browser.Contracts.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a request filter rule.
|
||||
/// </summary>
|
||||
public interface IRule
|
||||
{
|
||||
/// <summary>
|
||||
/// The filter result to be used if the rule matches a request.
|
||||
/// </summary>
|
||||
FilterResult Result { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the rule for processing requests.
|
||||
/// </summary>
|
||||
void Initialize(FilterRuleSettings settings);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the rule applies for the given request.
|
||||
/// </summary>
|
||||
bool IsMatch(Request request);
|
||||
}
|
||||
}
|
23
SafeExamBrowser.Browser.Contracts/Filters/IRuleFactory.cs
Normal file
23
SafeExamBrowser.Browser.Contracts/Filters/IRuleFactory.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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 SafeExamBrowser.Settings.Browser.Filter;
|
||||
|
||||
namespace SafeExamBrowser.Browser.Contracts.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds request filter rules.
|
||||
/// </summary>
|
||||
public interface IRuleFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a filter rule for the given type.
|
||||
/// </summary>
|
||||
IRule CreateRule(FilterRuleType type);
|
||||
}
|
||||
}
|
21
SafeExamBrowser.Browser.Contracts/Filters/Request.cs
Normal file
21
SafeExamBrowser.Browser.Contracts/Filters/Request.cs
Normal 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.Browser.Contracts.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds data relevant for filtering requests.
|
||||
/// </summary>
|
||||
public class Request
|
||||
{
|
||||
/// <summary>
|
||||
/// The full URL of the request.
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user