Example #1
0
 public static void ThrowIfRightsTemplatesInvalid(IEnumerable <string> templates, string tpdName, TrustedPublishingDomainImportUtilities tpdImportUtilities, Uri intranetLicensingUrl, Uri extranetLicensingUrl, out object failureTarget)
 {
     failureTarget = null;
     if (templates != null)
     {
         RmsUtil.ThrowIfStringParameterNullOrEmpty(tpdName, "tpdName");
         RmsUtil.ThrowIfParameterNull(tpdImportUtilities, "tpdImportUtilities");
         RmsUtil.ThrowIfParameterNull(intranetLicensingUrl, "intranetLicensingUrl");
         RmsUtil.ThrowIfParameterNull(extranetLicensingUrl, "extranetLicensingUrl");
         foreach (string template in templates)
         {
             Uri  templateDistributionPoint;
             Uri  templateDistributionPoint2;
             Guid templateGuid;
             try
             {
                 DrmClientUtils.ParseTemplate(template, out templateDistributionPoint, out templateDistributionPoint2, out templateGuid);
             }
             catch (RightsManagementException innerException)
             {
                 failureTarget = tpdName;
                 throw new InvalidTemplateException(innerException);
             }
             RmsUtil.ThrowIfRightsTemplateInvalid(tpdImportUtilities, tpdName, template, templateGuid, out failureTarget);
             RmsUtil.ThrowIfTemplateDistributionPointInvalid(templateDistributionPoint, RmsUtil.TemplateDistributionPointType.Intranet, templateGuid, intranetLicensingUrl, extranetLicensingUrl, out failureTarget);
             RmsUtil.ThrowIfTemplateDistributionPointInvalid(templateDistributionPoint2, RmsUtil.TemplateDistributionPointType.Extranet, templateGuid, intranetLicensingUrl, extranetLicensingUrl, out failureTarget);
         }
     }
 }
Example #2
0
        private void ValidateTemplate(string templateXrml, Uri intranetLicensingUrl, Uri extranetLicensingUrl)
        {
            Uri  uri  = null;
            Uri  uri2 = null;
            Guid templateGuid;

            DrmClientUtils.ParseTemplate(templateXrml, out uri, out uri2, out templateGuid);
            if (uri != null && Uri.Compare(uri, intranetLicensingUrl, UriComponents.SchemeAndServer, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) != 0 && Uri.Compare(uri, extranetLicensingUrl, UriComponents.SchemeAndServer, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) != 0)
            {
                base.WriteError(new FailedToMatchTemplateDistributionPointToLicensingUriException(templateGuid, uri, intranetLicensingUrl), (ErrorCategory)1000, intranetLicensingUrl);
            }
            if (uri2 != null && Uri.Compare(uri2, intranetLicensingUrl, UriComponents.SchemeAndServer, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) != 0 && Uri.Compare(uri2, extranetLicensingUrl, UriComponents.SchemeAndServer, UriFormat.UriEscaped, StringComparison.OrdinalIgnoreCase) != 0)
            {
                base.WriteError(new FailedToMatchTemplateDistributionPointToLicensingUriException(templateGuid, uri2, extranetLicensingUrl), (ErrorCategory)1000, extranetLicensingUrl);
            }
        }