blob: 38123376114a8d18e030aa3ea9dc93bb3047a975 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System;
using VNLib.Utils;
using VNLib.Plugins.Essentials.Endpoints;
namespace VNLib.Plugins.Essentials.Accounts.Admin.Helpers
{
/// <summary>
/// Provides an endpoint that provides optional protection against requests outside the local network
/// </summary>
internal abstract class LocalNetworkProtectedEndpoint : ProtectedWebEndpoint
{
private bool _localOnly;
/// <summary>
/// Specifies if requests outside of the local network are allowed.
/// </summary>
protected bool LocalOnly
{
get => _localOnly;
set => _localOnly = value;
}
protected override ERRNO PreProccess(HttpEntity entity)
{
return (!_localOnly || entity.IsLocalConnection) && base.PreProccess(entity);
}
}
}
|