5using System.Threading.Tasks;
57 Dictionary<string, string> AttachmentUrls =
new Dictionary<string, string>();
58 StringBuilder sb =
new StringBuilder();
64 LegalIdentityInfo IdentityInfo = await
QuickLogin.PrepareQuickLoginIdentity(Identity2,
"Session",
true,
null);
69 catch (XmlException ex)
109 string s = this.user?.UserName;
110 if (!
string.IsNullOrEmpty(s))
114 if (
string.IsNullOrEmpty(s))
115 s = this.identity.Id;
117 int i = s.IndexOf(
'@');
132 string s = this.user?.FederatedUserName;
133 if (!
string.IsNullOrEmpty(s))
137 return string.IsNullOrEmpty(s) ? this.identity.Id.Value : s;
148 string s = this.user?.FriendlyName;
149 if (!
string.IsNullOrEmpty(s))
153 if (!
string.IsNullOrEmpty(s))
177 if (Privilege.StartsWith(
"iotid:"))
178 return this.legalComponent.IsAccessToIdentityAuthorized(this.from.BareJid, Privilege[6..]);
179 else if (Privilege.StartsWith(
"iotsc:"))
180 return this.legalComponent.IsAccessToContractAuthorized(this.from.BareJid, Privilege[6..]);
191 return Task.FromResult(
new RequestOrigin(this.from.BareJid,
null,
null,
null,
this));
199 public Task<IEnumerable<KeyValuePair<string, object>>>
CreateClaims(
bool Encrypted)
201 if (this.user is
null)
202 return Task.FromResult<IEnumerable<KeyValuePair<string, object>>>(
null);
204 return this.user.CreateClaims(Encrypted);
215 params KeyValuePair<string, object>[] AdditionalClaims)
217 if (this.user is
null)
218 return Task.FromResult<
string>(
null);
220 return this.user.CreateToken(Factory, Encrypted, AdditionalClaims);
Helps with common XML-related tasks.
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
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 class managing the runtime environment of the IoT Gateway.
static bool IsDomain(string DomainOrHost, bool IncludeAlternativeDomains)
If a domain or host name represents the gateway.
LegalIdentity()
Legal identity
Property[] Properties
Properties detailing the legal identity.
Contains information about one XMPP address.
A factory that can create and validate JWT tokens.
User object representing a legal identity.
IUser User
Underlying Quick-Login user object.
string FederatedUserName
Full Federated User Name.
LegalIdentity Identity
Legal Identity object
string PasswordHash
Password hash
string FriendlyName
Friendly name of the user, for display purposes.
bool HasPrivilege(string Privilege)
If user has a given privilege.
Task< IEnumerable< KeyValuePair< string, object > > > CreateClaims(bool Encrypted)
Creates a set of claims identifying the user.
Task< RequestOrigin > GetOrigin()
Origin of request.
static async Task< LegalIdentityUser > Create(LegalIdentity Identity, XmppAddress From, LegalComponent LegalComponent)
Creates a user object representing a legal identity.
Task< string > CreateToken(JwtFactory Factory, bool Encrypted, params KeyValuePair< string, object >[] AdditionalClaims)
Creates a JWT Token referencing the user object.
XmppAddress From
Source of request.
string UserName
User name.
string PasswordHashType
Type of password hash
Legal (digital identities, smart contracts) service component.
Web resource that allows calling applications to enable Quick-Login using legal identities.
Tokens available in request.
Interfaces for legal identities.
Basic interface for a users with a Legal Identity.
Basic interface for a user.
A User that can participate in distributed operations, where the user is identified using a JWT token...
Interface for requestors that can act as an origin for distributed requests.