2using System.Collections.Generic;
3using System.Threading.Tasks;
34 public override bool HandlesSubPaths =>
true;
35 public override bool UserSessions =>
true;
43 ??
throw new ForbiddenException(
"Unauthorized access prohibited: No user authenticated");
45 if (
string.IsNullOrEmpty(Request.
SubPath))
48 string TokenId = Request.
SubPath.Substring(1);
49 int i = TokenId.IndexOf(
'@');
50 if (i < 0 || !Guid.TryParse(TokenId.Substring(0, i), out _))
54 ??
throw new NotFoundException(
"Token '" + TokenId +
"' not found on this neuron.");
60 if (Obj is
string TextNote)
72 Timestamp = DateTime.UtcNow,
73 TokenId = Token.TokenId
79 else if (Obj is XmlDocument XmlNote)
84 if (XmlNote.DocumentElement is
null)
87 if (
string.IsNullOrEmpty(XmlNote.DocumentElement.NamespaceURI))
90 AssertXmlSafe(XmlNote);
92 (string, Dictionary<string, ValidationSchema>) P = await
XmppServerModule.Legal.ValidateContent(XmlNote);
93 if (!
string.IsNullOrEmpty(P.Item1))
101 Note = XmlNote.DocumentElement.OuterXml,
102 LocalName = XmlNote.DocumentElement.LocalName,
103 Namespace = XmlNote.DocumentElement.NamespaceURI,
105 Timestamp = DateTime.UtcNow,
106 TokenId = Token.TokenId
116 private static void AssertXmlSafe(XmlNode Xml)
118 if (Xml is XmlProcessingInstruction)
121 if (Xml.HasChildNodes)
123 foreach (XmlNode N
in Xml.ChildNodes)
mTLS authentication mechanism, where identity is taken from a valid client certificate.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
Represents an HTTP request.
bool HasData
If the request has data.
string SubPath
Sub-path. If a resource is found handling the request, this property contains the trailing sub-path o...
async Task< object > DecodeDataAsync()
Decodes data sent in request.
Represets a response of an HTTP client request.
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
The server has not found anything matching the Request-URI. No indication is given of whether the con...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
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.
A text note logged on the token from an external source.
An xml note logged on the token from an external source.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
Duration? ArchiveRequired
Duration after which token expires, the token is required to be archived.
DateTime Expires
Expiry date of token.
Adds an external note to a token.
bool AllowsPOST
If the POST method is allowed.
async Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
AddNote()
Adds an external note to a token.
override HttpAuthenticationScheme[] GetAuthenticationSchemes(HttpRequest Request)
Any authentication schemes used to authenticate users before access is granted to the corresponding r...
Service Module hosting the XMPP broker and its components.
POST Interface for HTTP resources.
Basic interface for a user.