AipFileInfo.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System;
  2. namespace AipGateway.AIP
  3. {
  4. public class SetFileInfo
  5. {
  6. public int errorNo { get; set; }
  7. public string errorMsg { get; set; } = string.Empty;
  8. public string lableGuid { get; set; } = string.Empty;
  9. public string templateGuid { get; set; } = string.Empty;
  10. public string fileOwner { get; set; } = string.Empty;
  11. public Int64 fileSize { get; set; }
  12. public string newFileName { get; set; } = string.Empty;
  13. public string newFileOwner { get; set; } = string.Empty;
  14. public string newFileLabelGuid { get; set; } = string.Empty;
  15. public string newFileTemplateGuid { get; set; } = string.Empty;
  16. public Int64 newFileSize { get; set; }
  17. }
  18. public class AipFileInfo
  19. {
  20. public int errorCode { get; set; } = 0;
  21. public string errorMessage { get; set; } = string.Empty;
  22. public AipContentLabel Content{ get; set; }
  23. public AipLabel Label { get; set; }
  24. public AipProtection Protection { get; set; }
  25. public Int64 FileSize { get; set; }
  26. public string OutputFileName { get; set; }
  27. //public static implicit operator List<object>(AipFileInfo v)
  28. //{
  29. // throw new NotImplementedException();
  30. //}
  31. }
  32. public enum AipAssignmentMethod
  33. {
  34. /// <summary>Label assignment method is standard</summary>
  35. Standard,
  36. /// <summary>Label assignment method is privileged</summary>
  37. Privileged,
  38. /// <summary>Label assignment method is automatic</summary>
  39. Auto,
  40. }
  41. public enum AipProtectionType
  42. {
  43. /// <summary>Protection was created from a template</summary>
  44. TemplateBased,
  45. /// <summary>Protection was created ad hoc</summary>
  46. Custom,
  47. }
  48. public class AipLabelInfo
  49. {
  50. /// <summary>The unique GUID for the label within the tenant</summary>
  51. public string LabelId { get; set; } = "";
  52. /// <summary>GUID of the tenant that owns the label</summary>
  53. public string TenantId { get; set; } = "";
  54. }
  55. public class AipProtectionDescriptor
  56. {
  57. /// <summary>The protection type</summary>
  58. public AipProtectionType ProtectionType { get; set; }
  59. /// <summary>Collection of users-to-roles mappings</summary>
  60. // public List<Microsoft.InformationProtection.UserRoles> UserRoles { get; set; }
  61. //
  62. // /// <summary>Collection of users-to-rights mappings</summary>
  63. // public List<Microsoft.InformationProtection.UserRights> UserRights { get; set; }
  64. /// <summary>
  65. /// The RMS template id for template protection, license id for adhoc protection, if any
  66. /// </summary>
  67. public string TemplateId { get; set; }
  68. /// <summary>
  69. /// Gets the Label info, if any
  70. /// This property will only be populated in ProtectionDescriptors for preexisting protected content. i.e. It is
  71. /// a field populated by the server at the moment protected content is consumed.
  72. /// </summary>
  73. public AipLabelInfo LabelInformation { get; set; }
  74. /// <summary>
  75. /// Gets the Label id, if any
  76. /// This property will only be populated in ProtectionDescriptors for preexisting protected content. i.e. It is
  77. /// a field populated by the server at the moment protected content is consumed.
  78. /// </summary>
  79. public string LabelId { get; set; }
  80. /// <summary>The owner of protection</summary>
  81. public string Owner { get; set; }
  82. /// <summary>
  83. /// Gets the content id
  84. /// Publishing licenses will have this identifier surrounded by curly braces "{}".
  85. /// Those braces are removed from the value returned here
  86. /// </summary>
  87. public string ContentId { get; set; }
  88. /// <summary>The protection name</summary>
  89. public string Name { get; set; }
  90. /// <summary>The protection description</summary>
  91. public string Description { get; set; }
  92. /// <summary>
  93. /// Whether or not protection allows offline content access (default = true)
  94. /// </summary>
  95. public bool AllowOfflineAccess { get; set; }
  96. /// <summary>Protection referrer address</summary>
  97. public string Referrer { get; set; }
  98. /// <summary>Protection expiration time</summary>
  99. public DateTime? ContentValidUntil { get; set; }
  100. /// <summary>App-specific data that was encrypted</summary>
  101. // public Dictionary<string, string> EncryptedAppData { get; set; }
  102. //
  103. // /// <summary>App-specific data that was signed</summary>
  104. // public Dictionary<string, string> SignedAppData { get; set; }
  105. /// <summary>The double key url</summary>
  106. public string DoubleKeyUrl { get; set; }
  107. }
  108. public class AipProtection
  109. {
  110. public AipProtectionDescriptor ProtectionDescriptor { get; set; }
  111. /// <summary>Email address of content owner</summary>
  112. public string Owner { get; set; }
  113. /// <summary>The user associated with the protection handler</summary>
  114. public string IssuedTo { get; set; }
  115. /// <summary>Whether or not the current user is the content owner</summary>
  116. public bool IsIssuedToOwner { get; set; }
  117. /// <summary>
  118. /// The unique identifier for the document/content
  119. /// Publishing licenses will have this identifier surrounded by curly braces "{}".
  120. /// Those braces are removed from the value returned here
  121. /// </summary>
  122. public string ContentId { get; set; }
  123. /// <summary> Whether or not protection handler uses deprecated crypto algorithms (ECB) for backward compatibility </summary>
  124. public bool UseDeprecatedAlgorithms { get; set; }
  125. /// <summary> Whether or not protection handler grants user 'audited extract' right </summary>
  126. public bool AuditedExtractAllowed { get; set; }
  127. /// <summary> The block size (in bytes) for the cipher mode used by this ProtectionHandler </summary>
  128. public long BlockSize { get; set; }
  129. }
  130. public class AipContentLabel
  131. {
  132. //public AipLabel Label { get; set; }
  133. public DateTime CreationTime { get; set; }
  134. /// <summary>The assignment method of the label.</summary>
  135. public AipAssignmentMethod AssignmentMethod { get; set; }
  136. /// <summary>Returns true if protection was applied by the label or not.</summary>
  137. public bool IsProtectionAppliedFromLabel { get; set; }
  138. }
  139. }