3using System.Threading.Tasks;
24 return Array.Empty<
string>();
29 string FileName = Request.
SubPath;
30 if (FileName.StartsWith(
'/'))
31 FileName = FileName[1..];
35 !
XML.
TryParse(PublishedStr, out DateTime Published))
37 Log.
Error(
"Attempting to access package without valid signature or published date.",
46 Log.
Error(
"Attempting to access package that does not exist.",
54 if (Expected != Requested)
56 Log.
Error(
"Attempting to access package with invalid publishing timestamp.",
58 new KeyValuePair<string, object>(
"Expected", Expected),
59 new KeyValuePair<string, object>(
"Requested", Requested));
66 if (
string.Compare(Expected, SignatureStr,
true) != 0)
68 Log.
Error(
"Attempting to access package with invalid signature.",
70 new KeyValuePair<string, object>(
"Expected", Expected),
71 new KeyValuePair<string, object>(
"Requested", SignatureStr));
78 return new PackageUser(
Package);
81 private class PackageUser :
IUser
83 private readonly
Package package;
90 public string UserName => this.package.
FileName;
91 public string FederatedUserName => this.package.FileName;
92 public string FriendlyName => this.package.FileName;
93 public string PasswordHash =>
throw new InvalidOperationException();
94 public string PasswordHashType =>
throw new InvalidOperationException();
96 public bool HasPrivilege(
string Privilege)
Helps with common XML-related tasks.
static string Encode(string s)
Encodes a string for use in XML.
static bool TryParse(string s, out DateTime Value)
Tries to decode a string encoded DateTime.
Static class managing the application event log. Applications and services log events on this static ...
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.
static void Informational(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an informational event.
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
Represents an HTTP request.
HttpRequestHeader Header
Request header.
string RemoteEndPoint
Remote end-point.
string SubPath
Sub-path. If a resource is found handling the request, this property contains the trailing sub-path o...
Provisioning and registry service component.
Contains information about a software package.
string SignatureBase64Url
Base64-encoded version of Signature.
CaseInsensitiveString FileName
Filename of package.
DateTime Published
When package was published.
override string DisplayName
Display name for authentication scheme.
override async Task< IUser > IsAuthenticated(HttpRequest Request)
Checks if the request is authorized.
override string[] GetChallenges(HttpRequest Request)
Gets available challenges for the authenticating client to respond to.
Basic interface for a user.