Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BlockEndpoint.cs
1using System.Threading.Tasks;
2using System.Xml;
5
7{
11 public class BlockEndpoint : WafAction
12 {
13 private readonly StringAttribute reason;
14
19 : base()
20 {
21 }
22
30 : base(Xml, Parent, Document)
31 {
32 this.reason = new StringAttribute(Xml, "reason");
33 }
34
38 public override string LocalName => nameof(BlockEndpoint);
39
47 public override WafAction Create(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document) => new BlockEndpoint(Xml, Parent, Document);
48
54 public override async Task<WafResult?> Review(ProcessingState State)
55 {
56 string Reason = await this.reason.EvaluateAsync(State.Variables, string.Empty);
57
58 await State.Firewall.LoginAuditor.BlockEndpoint(State.Request.RemoteEndPoint, "HTTP", Reason);
59
60 return null;
61 }
62 }
63}
override WafAction Create(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Creates a WAF action from its XML definition.
override async Task< WafResult?> Review(ProcessingState State)
Reviews the processing state, and returns a WAF result, if any.
BlockEndpoint(XmlElement Xml, WafAction Parent, WebApplicationFirewall Document)
Blocks the endpoint.
override string LocalName
XML Local Name for the XML element defining the action.
Contains the current state of a review process.
Variables Variables
Set of variables.
WebApplicationFirewall Firewall
Reference to the current Web Application Firewall object.
HttpRequest Request
Current HTTP Request
Abstract base class for Web Application Firewall actions.
Definition: WafAction.cs:17
WebApplicationFirewall Document
Web Application Firewall document.
Definition: WafAction.cs:60
Web Application Firewall for HttpServer.
ILoginAuditor LoginAuditor
Login Auditor used by the Firewall.
Task< bool > BlockEndpoint(string RemoteEndPoint, string Protocol, string Reason)
Blocks and endpoint.