public UseLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, XmlNode[] issuanceLicense, object callerState, AsyncCallback callerCallback) : base(context, callerState, callerCallback)
 {
     ArgumentValidator.ThrowIfNull("licenseUri", licenseUri);
     RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("issuanceLicense", issuanceLicense);
     this.licenseUri      = licenseUri;
     this.issuanceLicense = issuanceLicense;
 }
 public static LicenseResponse[] GetLicenseResponses(UseLicenseResult[] endUseLicenses, Uri licenseUri)
 {
     RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("endUseLicenses", endUseLicenses);
     LicenseResponse[] array = new LicenseResponse[endUseLicenses.Length];
     for (int i = 0; i < endUseLicenses.Length; i++)
     {
         UseLicenseResult useLicenseResult = endUseLicenses[i];
         if (useLicenseResult.Error != null)
         {
             array[i] = new LicenseResponse(new RightsManagementException(RightsManagementFailureCode.OfflineRmsServerFailure, ServerStrings.FailedToAcquireUseLicense(licenseUri), useLicenseResult.Error));
         }
         else
         {
             ContentRight?usageRights;
             try
             {
                 usageRights = new ContentRight?(DrmClientUtils.GetUsageRightsFromLicense(useLicenseResult.EndUseLicense));
             }
             catch (RightsManagementException arg)
             {
                 Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceError <int, RightsManagementException>(0L, "Failed to get usage rights from license for recipient index {0}. Error {1}", i, arg);
                 usageRights = null;
             }
             array[i] = new LicenseResponse(useLicenseResult.EndUseLicense, usageRights);
         }
     }
     return(array);
 }
 public static LicenseeIdentity[] ConvertToLicenseeIdentities(RmsClientManagerContext context, string[] identities)
 {
     ArgumentValidator.ThrowIfNull("context", context);
     RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("identities", identities);
     LicenseeIdentity[] array = new LicenseeIdentity[identities.Length];
     for (int i = 0; i < identities.Length; i++)
     {
         if (!SmtpAddress.IsValidSmtpAddress(identities[i]))
         {
             throw new RightsManagementException(RightsManagementFailureCode.InvalidRecipient, ServerStrings.RecipientAddressInvalid(identities[i]));
         }
         ADRawEntry adrawEntry;
         try
         {
             adrawEntry = context.ResolveRecipient(identities[i]);
         }
         catch (ADTransientException innerException)
         {
             throw new ExchangeConfigurationException(ServerStrings.FailedToReadUserConfig(identities[i]), innerException);
         }
         catch (ADOperationException innerException2)
         {
             throw new RightsManagementException(RightsManagementFailureCode.ADUserNotFound, ServerStrings.FailedToReadUserConfig(identities[i]), innerException2);
         }
         IList <string> list = RmsClientManagerUtils.EmptyProxyList;
         string         text = null;
         bool           flag = false;
         if (adrawEntry != null)
         {
             ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)adrawEntry[ADRecipientSchema.EmailAddresses];
             if (proxyAddressCollection != null && proxyAddressCollection.Count != 0)
             {
                 list = new List <string>(proxyAddressCollection.Count);
                 foreach (ProxyAddress proxyAddress in proxyAddressCollection)
                 {
                     list.Add(proxyAddress.ValueString);
                 }
             }
             SmtpAddress smtpAddress = (SmtpAddress)adrawEntry[ADRecipientSchema.PrimarySmtpAddress];
             if (smtpAddress.IsValidAddress)
             {
                 text = smtpAddress.ToString();
             }
             flag = RmsClientManagerUtils.TreatRecipientAsRMSSuperuser(context.OrgId, (RecipientTypeDetails)adrawEntry[ADRecipientSchema.RecipientTypeDetails]);
         }
         array[i] = new LicenseeIdentity(string.IsNullOrEmpty(text) ? identities[i] : text, list, flag);
     }
     return(array);
 }
Esempio n. 4
0
 public FederationServerLicenseAsyncResult(RmsClientManagerContext context, Uri licenseUri, XmlNode[] issuanceLicense, LicenseIdentity[] identities, LicenseResponse[] responses, object callerState, AsyncCallback callerCallback) : base(context, licenseUri, issuanceLicense, callerState, callerCallback)
 {
     RmsClientManagerUtils.ThrowOnNullOrEmptyArrayArgument("identities", identities);
     this.identities = identities;
     this.responses  = responses;
 }