Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
IdentityApplication.cs
1using System;
3using System.Text;
4using System.Xml;
6using Waher.Events;
10
11namespace Paiwise
12{
17 {
18 private readonly string legalId;
19 private readonly Dictionary<string, ValidClaim> validatedClaims =
20 new Dictionary<string, ValidClaim>();
21 private readonly Dictionary<string, InvalidClaim> invalidatedClaims =
22 new Dictionary<string, InvalidClaim>();
23 private readonly Dictionary<string, bool> unvalidatedClaims =
24 new Dictionary<string, bool>();
25 private readonly Dictionary<string, ValidPhoto> validatedPhotos =
26 new Dictionary<string, ValidPhoto>();
27 private readonly Dictionary<string, InvalidPhoto> invalidatedPhotos =
28 new Dictionary<string, InvalidPhoto>();
29 private readonly Dictionary<string, IPhoto> unvalidatedPhotos =
30 new Dictionary<string, IPhoto>();
31 private readonly Dictionary<string, PotentialClaim> potentialClaims =
32 new Dictionary<string, PotentialClaim>();
33 private readonly ChunkedList<ValidationError> errors =
35 private readonly ChunkedList<object> services = new ChunkedList<object>();
36 private readonly PersonalInformation personalInformation;
37 private readonly KeyValuePair<string, object>[] claims;
38 private readonly IEnumerable<IPhoto> photos;
39 private readonly IEnumerable<XmlDocument> documents;
40 private readonly IAccount account;
41 private readonly object synchObj = new object();
42 private readonly string @namespace;
43 private readonly int nrPhotos;
44 private readonly bool preview;
45
59 public IdentityApplication(string LegalId, string Namespace, bool Preview,
60 PersonalInformation PersonalInformation, KeyValuePair<string, object>[] Claims,
61 IEnumerable<IPhoto> Photos, IAccount Account)
62 : this(LegalId, Namespace, Preview, PersonalInformation, Claims, Photos,
63 Array.Empty<XmlDocument>(), Account)
64 {
65 }
66
81 public IdentityApplication(string LegalId, string Namespace, bool Preview,
82 PersonalInformation PersonalInformation, KeyValuePair<string, object>[] Claims,
83 IEnumerable<IPhoto> Photos, IEnumerable<XmlDocument> Documents, IAccount Account)
84 {
85 this.legalId = LegalId;
86 this.account = Account;
87 this.@namespace = Namespace;
88 this.preview = Preview;
89 this.personalInformation = PersonalInformation;
90 this.claims = Claims;
91 this.photos = Photos;
92 this.nrPhotos = 0;
93 this.documents = Documents;
94
95 foreach (IPhoto _ in Photos)
96 this.nrPhotos++;
97
98 foreach (KeyValuePair<string, object> Claim in Claims)
99 this.unvalidatedClaims[Claim.Key] = true;
100
101 foreach (IPhoto Photo in Photos)
102 this.unvalidatedPhotos[Photo.Id] = Photo;
103 }
104
110 {
111 this.legalId = Application.legalId;
112 this.account = Application.Account;
113 this.@namespace = Application.@namespace;
114 this.preview = Application.Preview;
115 this.personalInformation = Application.PersonalInformation;
116 this.claims = Application.Claims;
117 this.photos = Application.Photos;
118 this.nrPhotos = Application.NrPhotos;
119 this.documents = Application.Documents;
120
121 foreach (KeyValuePair<string, object> Claim in Application.Claims)
122 this.unvalidatedClaims[Claim.Key] = true;
123
124 foreach (IPhoto Photo in Application.Photos)
125 this.unvalidatedPhotos[Photo.Id] = Photo;
126 }
127
132 public bool Preview => this.preview;
133
137 public IAccount Account => this.account;
138
142 public PersonalInformation PersonalInformation => this.personalInformation;
143
147 public KeyValuePair<string, object>[] Claims => this.claims;
148
152 public IEnumerable<IPhoto> Photos => this.photos;
153
157 public int NrPhotos => this.nrPhotos;
158
162 public IEnumerable<XmlDocument> Documents => this.documents;
163
169 public void ClaimValid(string Claim, object Service)
170 {
171 lock (this.synchObj)
172 {
173 if (this.unvalidatedClaims.Remove(Claim))
174 {
175 this.invalidatedClaims.Remove(Claim);
176 this.potentialClaims.Remove(Claim);
177
178 this.validatedClaims[Claim] = new ValidClaim(Claim, Service);
179
180 if (!this.services.Contains(Service))
181 this.services.Add(Service);
182 }
183 }
184 }
185
195 public void ClaimInvalid(string Claim, string Reason, string ReasonLanguage,
196 string ReasonCode, object Service)
197 {
198 lock (this.synchObj)
199 {
200 if (this.unvalidatedClaims.Remove(Claim))
201 {
202 this.validatedClaims.Remove(Claim);
203 this.potentialClaims.Remove(Claim);
204
205 this.invalidatedClaims[Claim] = new InvalidClaim(Claim, Reason, ReasonLanguage, ReasonCode, Service);
206
207 if (!this.services.Contains(Service))
208 this.services.Add(Service);
209 }
210 }
211 }
212
218 public void PhotoValid(IPhoto Photo, object Service)
219 {
220 lock (this.synchObj)
221 {
222 if (this.unvalidatedPhotos.Remove(Photo.Id))
223 {
224 this.invalidatedPhotos.Remove(Photo.Id);
225 this.validatedPhotos[Photo.Id] = new ValidPhoto(Photo, Service);
226
227 if (!this.services.Contains(Service))
228 this.services.Add(Service);
229 }
230 }
231 }
232
242 public void PhotoInvalid(IPhoto Photo, string Reason, string ReasonLanguage,
243 string ReasonCode, object Service)
244 {
245 lock (this.synchObj)
246 {
247 if (this.unvalidatedPhotos.Remove(Photo.Id))
248 {
249 this.validatedPhotos.Remove(Photo.Id);
250 this.invalidatedPhotos[Photo.Id] = new InvalidPhoto(Photo, Reason, ReasonLanguage, ReasonCode, Service);
251
252 if (!this.services.Contains(Service))
253 this.services.Add(Service);
254 }
255 }
256 }
257
267 public void ReportError(string Error, string ErrorLanguage, string ErrorCode,
268 ValidationErrorType ErrorType, object Service, params KeyValuePair<string, object>[] Tags)
269 {
270 lock (this.synchObj)
271 {
272 this.errors.Add(new ValidationError(ErrorType, Error, ErrorLanguage,
273 ErrorCode, Service, Tags));
274
275 if (!this.services.Contains(Service))
276 this.services.Add(Service);
277 }
278 }
279
284 {
285 get
286 {
287 lock (this.synchObj)
288 {
289 ValidClaim[] Result = new ValidClaim[this.validatedClaims.Count];
290 this.validatedClaims.Values.CopyTo(Result, 0);
291 return Result;
292 }
293 }
294 }
295
300 {
301 get
302 {
303 lock (this.synchObj)
304 {
305 InvalidClaim[] Result = new InvalidClaim[this.invalidatedClaims.Count];
306 this.invalidatedClaims.Values.CopyTo(Result, 0);
307 return Result;
308 }
309 }
310 }
311
315 public string[] UnvalidatedClaims
316 {
317 get
318 {
319 lock (this.synchObj)
320 {
321 string[] Result = new string[this.unvalidatedClaims.Count];
322 this.unvalidatedClaims.Keys.CopyTo(Result, 0);
323 return Result;
324 }
325 }
326 }
327
332 {
333 get
334 {
335 lock (this.synchObj)
336 {
337 ValidPhoto[] Result = new ValidPhoto[this.validatedPhotos.Count];
338 this.validatedPhotos.Values.CopyTo(Result, 0);
339 return Result;
340 }
341 }
342 }
343
348 {
349 get
350 {
351 lock (this.synchObj)
352 {
353 InvalidPhoto[] Result = new InvalidPhoto[this.invalidatedPhotos.Count];
354 this.invalidatedPhotos.Values.CopyTo(Result, 0);
355 return Result;
356 }
357 }
358 }
359
364 {
365 get
366 {
367 lock (this.synchObj)
368 {
369 IPhoto[] Result = new IPhoto[this.unvalidatedPhotos.Count];
370 this.unvalidatedPhotos.Values.CopyTo(Result, 0);
371 return Result;
372 }
373 }
374 }
375
380 {
381 get
382 {
383 lock (this.synchObj)
384 {
385 PotentialClaim[] Result = new PotentialClaim[this.potentialClaims.Count];
386 this.potentialClaims.Values.CopyTo(Result, 0);
387 return Result;
388 }
389 }
390 }
391
396 {
397 get
398 {
399 lock (this.synchObj)
400 {
401 return this.errors.ToArray();
402 }
403 }
404 }
405
409 public bool HasErrors
410 {
411 get
412 {
413 lock (this.synchObj)
414 {
415 return this.errors.Count > 0;
416 }
417 }
418 }
419
423 public int NrErrors
424 {
425 get
426 {
427 lock (this.synchObj)
428 {
429 return this.errors.Count;
430 }
431 }
432 }
433
437 public object[] Services
438 {
439 get
440 {
441 lock (this.synchObj)
442 {
443 return this.services.ToArray();
444 }
445 }
446 }
447
451 public bool HasServices
452 {
453 get
454 {
455 lock (this.synchObj)
456 {
457 return this.services.Count > 0;
458 }
459 }
460 }
461
465 public int NrServices
466 {
467 get
468 {
469 lock (this.synchObj)
470 {
471 return this.services.Count;
472 }
473 }
474 }
475
480 public bool? IsValid
481 {
482 get
483 {
484 lock (this.synchObj)
485 {
486 if (this.invalidatedClaims.Count > 0 || this.invalidatedPhotos.Count > 0)
487 return false;
488
489 if (this.errors.Count > 0)
490 {
491 foreach (ValidationError Error in this.errors)
492 {
493 if (Error.ErrorType == ValidationErrorType.Client)
494 return false;
495 }
496 }
497
498 if (this.unvalidatedClaims.Count > 0 ||
499 this.unvalidatedPhotos.Count > 0 ||
500 this.errors.Count > 0)
501 {
502 return null;
503 }
504
505 return true;
506 }
507 }
508 }
509
514 {
515 get
516 {
517 lock (this.synchObj)
518 {
519 return this.validatedClaims.Count > 0;
520 }
521 }
522 }
523
528 {
529 get
530 {
531 lock (this.synchObj)
532 {
533 return this.validatedPhotos.Count > 0;
534 }
535 }
536 }
537
542 {
543 get
544 {
545 lock (this.synchObj)
546 {
547 return this.potentialClaims.Count > 0;
548 }
549 }
550 }
551
555 public KeyValuePair<string, object>[] Tags
556 {
557 get
558 {
559 lock (this.synchObj)
560 {
563
564 int NrServices = this.services.Count;
565 int NrErrors = this.invalidatedClaims.Count + this.invalidatedPhotos.Count + this.errors.Count;
566 int i;
567
568 if (!this.preview)
569 {
570 foreach (KeyValuePair<string, object> Claim in this.claims)
571 Result.Add(Claim);
572 }
573 else
574 if (NrServices > 0)
575 {
576 i = 0;
577 foreach (object Service in this.services)
578 {
579 Result.Add(new KeyValuePair<string, object>(
580 TagName("Authenticator", ++i, NrServices),
581 Service.GetType().Namespace));
582 }
583 }
584
585 if (NrErrors > 0)
586 {
587 i = 0;
588
589 foreach (InvalidClaim InvalidClaim in this.invalidatedClaims.Values)
590 AppendTags(Result, (ValidationError)InvalidClaim, ref i, NrErrors);
591
592 foreach (InvalidPhoto InvalidPhoto in this.invalidatedPhotos.Values)
593 AppendTags(Result, (ValidationError)InvalidPhoto, ref i, NrErrors);
594
595 foreach (ValidationError Error in this.errors)
596 AppendTags(Result, Error, ref i, NrErrors);
597 }
598
599 return Result.ToArray();
600 }
601 }
602 }
603
604 private static void AppendTags(ChunkedList<KeyValuePair<string, object>> Result,
605 ValidationError Error, ref int i, int NrErrors)
606 {
607 i++;
608
609 Result.Add(new KeyValuePair<string, object>(
610 TagName("Error Type", i, NrErrors),
611 Error.ErrorType.ToString()));
612
613 Result.Add(new KeyValuePair<string, object>(
614 TagName("Error Language", i, NrErrors),
615 Error.ErrorLanguage));
616
617 Result.Add(new KeyValuePair<string, object>(
618 TagName("Error Code", i, NrErrors),
619 Error.ErrorCode));
620
621 Result.Add(new KeyValuePair<string, object>(
622 TagName("Error", i, NrErrors),
623 Error.ErrorMessage));
624 }
625
629 public void LogResults()
630 {
632 {
633 new KeyValuePair<string, object>("Result", this.IsValid),
634 new KeyValuePair<string, object>("Contact", this.personalInformation.EMail)
635 };
636
637 lock (this.synchObj)
638 {
639 foreach (KeyValuePair<string, ValidClaim> Claim in this.validatedClaims)
640 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Validator:" + Claim.Value.Service.GetType().FullName));
641
642 foreach (KeyValuePair<string, ValidPhoto> Claim in this.validatedPhotos)
643 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Validator:" + Claim.Value.Service.GetType().FullName));
644
645 foreach (KeyValuePair<string, InvalidClaim> Claim in this.invalidatedClaims)
646 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Invalidator:" + Claim.Value.Service.GetType().FullName));
647
648 foreach (KeyValuePair<string, InvalidPhoto> Claim in this.invalidatedPhotos)
649 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Invalidator:" + Claim.Value.Service.GetType().FullName));
650
651 foreach (KeyValuePair<string, bool> Claim in this.unvalidatedClaims)
652 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Unvalidated"));
653
654 foreach (KeyValuePair<string, IPhoto> Claim in this.unvalidatedPhotos)
655 Result.Add(new KeyValuePair<string, object>(Claim.Key, "Unvalidated"));
656 }
657
658 Log.Informational("Automatic identity review concluded.", this.legalId,
659 this.personalInformation.Jid, "IdReviewPerformed", Result.ToArray());
660 }
661
662 private static string TagName(string Base, int Index, int Nr)
663 {
664 if (Nr > 1)
665 return Base + " " + Index.ToString();
666 else
667 return Base;
668 }
669
674 {
675 get
676 {
677 lock (this.synchObj)
678 {
679 foreach (InvalidClaim InvalidClaim in this.invalidatedClaims.Values)
681
682 foreach (InvalidPhoto InvalidPhoto in this.invalidatedPhotos.Values)
684
685 foreach (ValidationError ValidationError in this.errors)
686 return ValidationError;
687 }
688
689 return null;
690 }
691 }
692
701 public string GetClientErrorMessageXml(out string Language, string DefaultMessage,
702 string DefaultMessageCode, string DefaultLanguage)
703 {
704 StringBuilder Xml = new StringBuilder();
705 IValidationError Error = this.FirstError;
706
707 Language = Error?.ErrorLanguage ?? DefaultLanguage;
708
709 Xml.Append("<body>");
710 Xml.Append(XML.Encode(Error?.ErrorMessage ?? DefaultMessage));
711 Xml.Append("</body>");
712 Xml.Append("<clientMessage xmlns='");
713 Xml.Append(this.@namespace);
714 Xml.Append("' id='");
715 Xml.Append(XML.Encode(this.legalId));
716 Xml.Append("' code='");
717 Xml.Append(XML.Encode(Error?.ErrorCode ?? DefaultMessageCode));
718 Xml.Append("' type='");
719 Xml.Append(Error?.ErrorType.ToString() ?? "Client");
720 Xml.Append("'>");
721
722 this.AppendApplicationStatus(Xml);
723
724 Xml.Append("</clientMessage>");
725
726 return Xml.ToString();
727 }
728
733 public string GetIdentityReviewXml()
734 {
735 StringBuilder Xml = new StringBuilder();
736
737 Xml.Append("<identityReview xmlns='");
738 Xml.Append(this.@namespace);
739 Xml.Append("' id='");
740 Xml.Append(XML.Encode(this.legalId));
741 Xml.Append("'>");
742
743 this.AppendApplicationStatus(Xml);
744
745 Xml.Append("</identityReview>");
746
747 return Xml.ToString();
748 }
749
750 private void AppendApplicationStatus(StringBuilder Xml)
751 {
752 lock (this.synchObj)
753 {
754 foreach (InvalidClaim InvalidClaim in this.invalidatedClaims.Values)
755 {
756 Xml.Append("<invalidClaim claim='");
757 Xml.Append(XML.Encode(InvalidClaim.Claim));
758 Xml.Append("' message='");
759 Xml.Append(XML.Encode(InvalidClaim.Reason));
760
761 if (!string.IsNullOrEmpty(InvalidClaim.ReasonCode))
762 {
763 Xml.Append("' code='");
764 Xml.Append(XML.Encode(InvalidClaim.ReasonCode));
765 }
766
767 AppendService(Xml, InvalidClaim.Service);
768
769 if (!string.IsNullOrEmpty(InvalidClaim.ReasonLanguage))
770 {
771 Xml.Append("' xml:lang='");
772 Xml.Append(XML.Encode(InvalidClaim.ReasonLanguage));
773 }
774
775 Xml.Append("'/>");
776 }
777
778 foreach (InvalidPhoto InvalidPhoto in this.invalidatedPhotos.Values)
779 {
780 Xml.Append("<invalidPhoto fileName='");
781 Xml.Append(XML.Encode(InvalidPhoto.Photo.FileName));
782 Xml.Append("' message='");
783 Xml.Append(XML.Encode(InvalidPhoto.Reason));
784
785 if (!string.IsNullOrEmpty(InvalidPhoto.ReasonCode))
786 {
787 Xml.Append("' code='");
788 Xml.Append(XML.Encode(InvalidPhoto.ReasonCode));
789 }
790
791 AppendService(Xml, InvalidPhoto.Service);
792
793 if (!string.IsNullOrEmpty(InvalidPhoto.ReasonLanguage))
794 {
795 Xml.Append("' xml:lang='");
796 Xml.Append(XML.Encode(InvalidPhoto.ReasonLanguage));
797 }
798
799 Xml.Append("'/>");
800 }
801
802 foreach (ValidationError ValidationError in this.errors)
803 {
804 Xml.Append("<error message='");
805 Xml.Append(XML.Encode(ValidationError.ErrorMessage));
806 Xml.Append("' type='");
807 Xml.Append(XML.Encode(ValidationError.ErrorType.ToString()));
808
809 if (!string.IsNullOrEmpty(ValidationError.ErrorCode))
810 {
811 Xml.Append("' code='");
812 Xml.Append(XML.Encode(ValidationError.ErrorCode));
813 }
814
815 AppendService(Xml, ValidationError.Service);
816
817 if (!string.IsNullOrEmpty(ValidationError.ErrorLanguage))
818 {
819 Xml.Append("' xml:lang='");
820 Xml.Append(XML.Encode(ValidationError.ErrorLanguage));
821 }
822
823 if (ValidationError.Tags.Length == 0)
824 Xml.Append("'/>");
825 else
826 {
827 Xml.Append('>');
828 XmppEventSink.AppendTags(Xml, ValidationError.Tags);
829 Xml.Append("</error>");
830 }
831 }
832
833 foreach (ValidClaim ValidClaim in this.validatedClaims.Values)
834 {
835 Xml.Append("<validatedClaim claim='");
836 Xml.Append(XML.Encode(ValidClaim.Claim));
837 AppendService(Xml, ValidClaim.Service);
838 Xml.Append("'/>");
839 }
840
841 foreach (ValidPhoto ValidPhoto in this.validatedPhotos.Values)
842 {
843 Xml.Append("<validatedPhoto fileName='");
844 Xml.Append(XML.Encode(ValidPhoto.Photo.FileName));
845 AppendService(Xml, ValidPhoto.Service);
846 Xml.Append("'/>");
847 }
848
849 foreach (PotentialClaim PotentialClaim in this.potentialClaims.Values)
850 {
851 if (PotentialClaim.InformUser)
852 {
853 Xml.Append("<potentialClaim claim='");
854 Xml.Append(XML.Encode(PotentialClaim.Claim));
855 Xml.Append("' value='");
856 Xml.Append(XML.Encode(PotentialClaim.Value?.ToString() ?? string.Empty));
857 AppendService(Xml, PotentialClaim.Service);
858 Xml.Append("'/>");
859 }
860 }
861
862 foreach (string UnvalidatedClaim in this.unvalidatedClaims.Keys)
863 {
864 Xml.Append("<unvalidatedClaim claim='");
865 Xml.Append(XML.Encode(UnvalidatedClaim));
866 Xml.Append("'/>");
867 }
868
869 foreach (IPhoto UnvalidatedPhoto in this.unvalidatedPhotos.Values)
870 {
871 Xml.Append("<unvalidatedPhoto fileName='");
872 Xml.Append(XML.Encode(UnvalidatedPhoto.FileName));
873 Xml.Append("'/>");
874 }
875 }
876 }
877
878 private static void AppendService(StringBuilder Xml, object Service)
879 {
880 if (!(Service is null))
881 {
882 Xml.Append("' service='");
883
884 if (Service is Type T)
885 Xml.Append(XML.Encode(T.FullName));
886 else
887 Xml.Append(XML.Encode(Service.GetType().FullName));
888 }
889 }
890
894 public void ValidateAllClaims()
895 {
896 foreach (KeyValuePair<string, object> Claim in this.Claims)
897 this.ClaimValid(Claim.Key, this);
898 }
899
903 public void ValidateAllPhotos()
904 {
905 foreach (IPhoto Photo in this.Photos)
906 this.PhotoValid(Photo, this);
907 }
908
916 public void InvalidateAllClaims(string Reason, string ReasonLanguage,
917 string ReasonCode)
918 {
919 foreach (KeyValuePair<string, object> Claim in this.Claims)
920 this.ClaimInvalid(Claim.Key, Reason, ReasonLanguage, ReasonCode, this);
921 }
922
923
931 public void InvalidateAllPhotos(string Reason, string ReasonLanguage,
932 string ReasonCode)
933 {
934 foreach (IPhoto Photo in this.Photos)
935 this.PhotoInvalid(Photo, Reason, ReasonLanguage, ReasonCode, this);
936 }
937
947 public bool TryGetValue<T>(string Claim, object Value, object Service, out T TypedValue)
948 {
949 if (Value is T Typed)
950 {
951 TypedValue = Typed;
952 return true;
953 }
954 else
955 {
956 this.ClaimInvalid(Claim, "Expected value of type " + typeof(T).FullName + ".",
957 "en", "InvalidType", Service);
958
959 TypedValue = default;
960 return false;
961 }
962 }
963
974 public void AddPotentialClaims(string Claim, object Value, bool InformUser, object Service)
975 {
976 lock (this.synchObj)
977 {
978 if (!this.unvalidatedClaims.Remove(Claim))
979 {
980 if (this.invalidatedClaims.ContainsKey(Claim) ||
981 this.validatedClaims.ContainsKey(Claim) ||
982 this.potentialClaims.ContainsKey(Claim))
983 {
984 return;
985 }
986 }
987
988 this.validatedClaims.Remove(Claim);
989 this.invalidatedClaims.Remove(Claim);
990
991 this.potentialClaims[Claim] = new PotentialClaim(Claim, Value, InformUser, Service);
992
993 if (!this.services.Contains(Service))
994 this.services.Add(Service);
995 }
996 }
997 }
998}
Contains information about a legal identity application.
ValidPhoto[] ValidatedPhotos
Validated photos.
string[] UnvalidatedClaims
Unvalidated claims.
int NrPhotos
Number of photos provided.
IEnumerable< IPhoto > Photos
Photos provided.
void ReportError(string Error, string ErrorLanguage, string ErrorCode, ValidationErrorType ErrorType, object Service, params KeyValuePair< string, object >[] Tags)
Reports an error encountered during validation.
void ClaimValid(string Claim, object Service)
An identity authenticator service validates a claim.
bool HasValidatedClaims
If the application has validated claims.
bool HasValidatedPhotos
If the application has validated photos.
IdentityApplication(string LegalId, string Namespace, bool Preview, PersonalInformation PersonalInformation, KeyValuePair< string, object >[] Claims, IEnumerable< IPhoto > Photos, IEnumerable< XmlDocument > Documents, IAccount Account)
Contains information about a legal identity application.
bool HasErrors
If errors are reported.
bool TryGetValue< T >(string Claim, object Value, object Service, out T TypedValue)
Tries to get a typed claim value from an untyped claim value.
IPhoto[] UnvalidatedPhotos
Unvalidated photos.
IAccount Account
Account over which the application was made.
void PhotoInvalid(IPhoto Photo, string Reason, string ReasonLanguage, string ReasonCode, object Service)
An identity authenticator service invalidates a photo.
InvalidPhoto[] InvalidatedPhotos
Invalidated photos.
void InvalidateAllClaims(string Reason, string ReasonLanguage, string ReasonCode)
Invalidates all claims.
PotentialClaim[] PotentialClaims
Potential claims
string GetIdentityReviewXml()
Gets information about the review as XML.
bool Preview
If the application is a preview of an application. Previewed applications should not be persisted.
void ValidateAllClaims()
Validates all claims.
KeyValuePair< string, object >[] Tags
Tags annotating the application, as reported by the different services.
int NrErrors
Number of errors reported.
ValidClaim[] ValidatedClaims
Validated claims.
IdentityApplication(string LegalId, string Namespace, bool Preview, PersonalInformation PersonalInformation, KeyValuePair< string, object >[] Claims, IEnumerable< IPhoto > Photos, IAccount Account)
Contains information about a legal identity application.
void InvalidateAllPhotos(string Reason, string ReasonLanguage, string ReasonCode)
Invalidates all photos
int NrServices
Number of services returning feedback on the the application.
string GetClientErrorMessageXml(out string Language, string DefaultMessage, string DefaultMessageCode, string DefaultLanguage)
Gets the XML of the client error message.
void LogResults()
Logs the results of the validation process to the event log.
void AddPotentialClaims(string Claim, object Value, bool InformUser, object Service)
Adds potential claims to the application that can be used in a subsequent applcation....
bool HasServices
If services have returned feedback on the application.
IValidationError FirstError
First error encountered during validation.
object[] Services
Services involved in returning feedback on the application.
void ValidateAllPhotos()
Validates all photos
IEnumerable< XmlDocument > Documents
Associated XML document attachments provided.
void ClaimInvalid(string Claim, string Reason, string ReasonLanguage, string ReasonCode, object Service)
An identity authenticator service invalidates a claim.
bool HasPotentialClaims
If the application has potential claims.
IdentityApplication(IdentityApplication Application)
Contains information about a legal identity application.
InvalidClaim[] InvalidatedClaims
Invalidated claims.
bool? IsValid
If the application has been validated (true), invalidated (false), or not yet validated (null).
KeyValuePair< string, object >[] Claims
Full set of claims made regarding the identity, as meta-data tags.
ValidationError[] Errors
Any errors reported during validation.
void PhotoValid(IPhoto Photo, object Service)
An identity authenticator service validates a photo.
Represents an invalidated claim.
Definition: InvalidClaim.cs:10
string Reason
Reason for invalidating claim.
Definition: InvalidClaim.cs:43
string Claim
Identifier of claim
Definition: InvalidClaim.cs:33
string ReasonLanguage
ISO code of language used for Reason.
Definition: InvalidClaim.cs:48
string ReasonCode
A machine-readable code for the reason for invalidating the claim. (Each service can define its own r...
Definition: InvalidClaim.cs:54
object Service
Service invalidating claim.
Definition: InvalidClaim.cs:38
Represents an invalidated photo.
Definition: InvalidPhoto.cs:10
Contains personal information found in a legal identity.
Represents a photo in an identity application.
Definition: Photo.cs:11
string Id
Unique identifier for photo.
Definition: Photo.cs:33
Represents a potential claim.
Represents a validated claim.
Definition: ValidClaim.cs:10
Represents a validated photo.
Definition: ValidPhoto.cs:10
Contains information about a validation error.
string ErrorLanguage
Language ISO code of ErrorMessage.
string ErrorCode
Machine-readable error code (service-specific).
string ErrorMessage
Error message that can be sent to origin
ValidationErrorType ErrorType
Type of error.
Helps with common XML-related tasks.
Definition: XML.cs:21
static string Encode(string s)
Encodes a string for use in XML.
Definition: XML.cs:29
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:14
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.
Definition: Log.cs:344
Event sink sending events to a destination over the XMPP network.
static void AppendTags(StringBuilder Xml, params KeyValuePair< string, object >[] Tags)
Appends a collection of tags to an XML string.
A chunked list is a linked list of chunks of objects of type T .
Definition: ChunkedList.cs:54
void Add(T Item)
Adds an item to the collection.
Definition: ChunkedList.cs:272
T[] ToArray()
Returns an array containing all elements of the collection.
Interface for identity applications.
Interface for photos.
Definition: IPhoto.cs:10
Contains information about a validation error.
string ErrorLanguage
Language ISO code of ErrorMessage.
string ErrorMessage
Error message that can be sent to origin
string ErrorCode
Machine-readable error code (service-specific).
Interface for SMTP user accounts.
Definition: IAccount.cs:11
Definition: ImplTypes.g.cs:58
ValidationErrorType
Type of validation error.