3using System.Security.Cryptography.X509Certificates;
4using System.Threading.Tasks;
24 [ModuleDependency(
"Waher.Service.IoTBroker.XmppServerModule")]
27 internal const string PostPrivileges =
"Admin.SensorData.Post";
32 private static X509Certificate certificate;
34 private static string rootFolder;
46 Log.
Error(
"Local Web Server not found.");
47 return Task.CompletedTask;
50 webServer = WebServer;
53 !(Obj is
string RootFolder))
59 rootFolder = RootFolder;
80 return Task.CompletedTask;
93 if (
string.IsNullOrEmpty(Request.
SubPath))
182 Uri ResourceMetaData,
string RequiredPrivilege)
207 Networking.HTTP.Authentication.RequiredPrivileges.GetAuthorization(
RequiredPrivileges));
221 !(Obj is X509Certificate Certificate))
236 certificate = Certificate;
238 Encrypted = Domain !=
"localhost";
257 List<HttpAuthenticationScheme> Schemes =
new List<HttpAuthenticationScheme>();
276 if (!(webServer is
null) && webServer.ClientCertificates !=
ClientCertificates.NotUsed)
284 if (!(webServer is
null))
287 if (Authorization is
null)
288 return Schemes.ToArray();
312 if (localWebServerNode is
null)
328 if (!(webServer is
null) && !(api is
null))
335 return Task.CompletedTask;
344 certificate = Certificate;
350 internal static X509Certificate Certificate => certificate;
355 internal static string RootFolder => rootFolder;
360 internal static HttpServer WebServer => webServer;
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
Implements a binary TCP Client, by encapsulating a TcpClient. It also makes the use of TcpClient safe...
static string GetDomainFromSubject(string Subject)
Extracts the domain name from a certificate subject string.
Basic authentication mechanism, as defined in RFC 2617: https://tools.ietf.org/html/rfc2617
Digest authentication mechanism, as defined in RFC 2617: https://tools.ietf.org/html/rfc2617
mTLS authentication mechanism, where identity is taken from a valid client certificate.
Represents an HTTP authentication scheme that embeds a collection of authentication schemes,...
Authentication mechanism that makes sure the user has an established session with the web server.
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
Represents an HTTP request.
string SubPath
Sub-path. If a resource is found handling the request, this property contains the trailing sub-path o...
Implements an HTTP server.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool Unregister(HttpResource Resource)
Unregisters a resource from the server.
override void Add(ISniffer Sniffer)
ICommunicationLayer.Add
Static class that dynamically manages types and interfaces available in the runtime environment.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Basic access point for runtime language localization.
static async Task< Language > GetDefaultLanguageAsync()
Gets the default language.
Class that can be used to schedule events in time. It uses a timer to execute tasks at the appointed ...
Authorization based on a single privilege.
Use JWT tokens for authentication. The Bearer scheme defined in RFC 6750 is used: https://tools....
A factory that can create and validate JWT tokens.
bool Disposed
If the factory has been disposed.
Corresponds to a privilege in the system.
Corresponds to a user in the system.
bool HasPrivilege(string Privilege)
If the user has a given privilege.
Maintains the collection of all users in the system.
static IUserSource Source
User source.
static HttpAuthenticationScheme[] GetAuthenticationSchemes()
Gets an array of authentication schemes available to authorize access to a web resource.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(string RequiredPrivilege)
Gets an array of authentication schemes available to authorize access to a web resource.
bool IsAuthorized(HttpRequest Request, IHasPrivileges User)
Checks if an user or object is authorized to perform an action.
static async Task CheckLocalWebServerNode()
Checks if the Local Web Server Node has been created.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(Uri ResourceMetaData, IAuthorization< HttpRequest > Authorization)
Gets an array of authentication schemes available to authorize access to a web resource.
Task Start()
Starts the module.
Task Stop()
Stops the module.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(IAuthorization< HttpRequest > Authorization)
Gets an array of authentication schemes available to authorize access to a web resource.
void UpdateCertificate(X509Certificate Certificate)
Updates the certificate used in mTLS negotiation.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(Uri ResourceMetaData, params string[] RequiredPrivileges)
Gets an array of authentication schemes available to authorize access to a web resource.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(params string[] RequiredPrivileges)
Gets an array of authentication schemes available to authorize access to a web resource.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(Uri ResourceMetaData, string RequiredPrivilege)
Gets an array of authentication schemes available to authorize access to a web resource.
static HttpAuthenticationScheme[] GetAuthenticationSchemes(Uri ResourceMetaData)
Gets an array of authentication schemes available to authorize access to a web resource.
static void GetDomainParameters(out string Domain, out int MinStrength, out bool Encrypted)
Gets domain parameters used in authentication.
Node representing the local web server.
Web Service REST API that receives sensor data from external sources.
Defines the Metering Topology data source. This data source contains a tree structure of persistent r...
static Root Root
Root node.
Interface for late-bound modules loaded at runtime.
Basic authorization interface for objects of type T .
Interface for objects that have privileges.
Interface for Mutual TLS (mTLS) Clients or TLS servers.
Interface for data sources containing users.
Interface for nodes that are published through the concentrator interface.
DigestAlgorithm
Digest algorithm
ClientCertificates
Client Certificate Options