2using System.Collections.Generic;
3using System.Threading.Tasks;
24 : base(
"Account/WwwLogin",
25 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
46 double Seconds = (double)Parameters[
"PSeconds"].AssociatedObjectValue;
48 int IssuedAt = (int)Math.Round(DateTime.UtcNow.Subtract(
JSON.
UnixEpoch).TotalSeconds);
49 int Expires = IssuedAt + (int)Seconds;
51 string Token = Factory.
Create(
61 {
"expires", Expires }
Helps with common JSON-related tasks.
static readonly DateTime UnixEpoch
Unix Date and Time epoch, starting at 1970-01-01T00:00:00Z
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing loading of resources stored as embedded resources or in content files.
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
Static class managing the runtime environment of the IoT Gateway.
static CaseInsensitiveString Domain
Domain name.
static byte[] NextBytes(int NrBytes)
Generates an array of random bytes.
Represents an HTTP request.
Represets a response of an HTTP client request.
async Task Return(object Object)
Returns an object to the client. This method can only be called once per response,...
Class managing a script expression.
Static class containing predefined JWT claim names.
const string Issuer
Issuer of the JWT
const string IssueTime
Time at which the JWT was issued; can be used to determine age of the JWT
const string JwtId
Unique identifier; can be used to prevent the JWT from being replayed (allows a token to be used only...
const string Subject
Subject of the JWT (the user)
const string ExpirationTime
Time after which the JWT expires
string Create(params KeyValuePair< string, object >[] Claims)
Creates a new JWT token.
string UserName
User Name.
Allows the client to login, using the WWW-Authenticate header in HTTP.
WwwLogin()
Allows the client to login, using the WWW-Authenticate header in HTTP.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
Abstract base class for agent resources supporting the POST method.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd