Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
WebServer.cs
1using System.Collections.Generic;
2using System.Threading.Tasks;
5using Waher.Things;
8
10{
15 {
16 internal const string Id = "WebServer";
17
23 : base(Source, null)
24 {
25 }
26
30 [Page(7, "Configuration")]
31 [Header(14, "Client Certificates (mTLS):")]
32 [ToolTip(15, "How to allow clients authenticate themselves using X.509 certificates.")]
33 [Required]
34 [Option(ClientCertificates.NotUsed, 16, "Client certificates are not used, and will not be requested.")]
35 [Option(ClientCertificates.Optional, 17, "Client certificates are requested, but not required.")]
36 [Option(ClientCertificates.Required, 18, "Client certificates are requested, and required.")]
38
42 [Page(7, "Configuration")]
43 [Header(19, "Trust client certificates.")]
44 [ToolTip(20, "If client certificates should be trusted, even if they don't validate.")]
45 public bool TrustClientCertificates { get; set; }
46
50 public override string NodeId => Id;
51
56 public override Task<string> GetTypeNameAsync(Language Language) => Language.GetStringAsync(typeof(GatewayConfigSource), 64, "Web Server");
57
63 public override Task<bool> AcceptsChildAsync(INode Child)
64 {
65 return Task.FromResult(
66 Child is DefaultPage ||
67 Child is FileFolder ||
68 Child is VanityResource ||
69 Child is ContentEncoding ||
70 Child is Redirection ||
71 Child is ProxyResource ||
72 Child is MTlsPort ||
74 }
75
82 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
83 {
84 LinkedList<Parameter> Parameters = new LinkedList<Parameter>();
86
87 Parameters.AddLast(new StringParameter("Protocol", await Namespace.GetStringAsync(108, "Certificates"), this.ClientCertificates.ToString()));
88 Parameters.AddLast(new BooleanParameter("Trust", await Namespace.GetStringAsync(109, "Trust"), this.TrustClientCertificates));
89
90 return Parameters;
91 }
92
98 public override Task<bool> CanDestroyAsync(RequestOrigin Caller)
99 {
100 return Task.FromResult(false);
101 }
102 }
103}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
GatewayConfigSource Source
Source hosting the node.
Configures a Content-Encoding in the web server.
mTLS-configuration for a specific port number.
Definition: MTlsPort.cs:15
Defines a proxy resource to act as a reverse proxy.
WebServer(GatewayConfigSource Source)
Settings for the Web Server.
Definition: WebServer.cs:22
override Task< bool > AcceptsChildAsync(INode Child)
If the node accepts a presumptive child, i.e. can receive as a child (if that child accepts the node ...
Definition: WebServer.cs:63
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
Definition: WebServer.cs:82
override Task< bool > CanDestroyAsync(RequestOrigin Caller)
If the node can be destroyed to by the caller.
Definition: WebServer.cs:98
bool TrustClientCertificates
If certificates are to be trusted, or if they are required to be valid.
Definition: WebServer.cs:45
Tokens available in request.
Definition: RequestOrigin.cs:9
Interface for nodes that are published through the concentrator interface.
Definition: INode.cs:49
ClientCertificates
Client Certificate Options