public TrustedDocDomain Import(Guid externalDirectoryOrgId) { RmsUtil.ThrowIfGuidEmpty(externalDirectoryOrgId, "externalDirectoryOrgId"); X509Certificate2 authenticationCertificate = this.LoadAuthenticationCertificate(); this.ThrowIfAuthenticationCertificateIsInvalid(authenticationCertificate); ITenantManagementService tenantManagementService = this.CreateRmsOnlineWebServiceProxy(authenticationCertificate); TrustedDocDomain result; try { TenantInfo[] tenantInfo = tenantManagementService.GetTenantInfo(new string[] { externalDirectoryOrgId.ToString() }); RmsUtil.ThrowIfTenantInfoisNull(tenantInfo, externalDirectoryOrgId); RmsUtil.ThrowIfZeroOrMultipleTenantInfoObjectsReturned(tenantInfo, externalDirectoryOrgId); RmsUtil.ThrowIfErrorInfoObjectReturned(tenantInfo[0], externalDirectoryOrgId); RmsUtil.ThrowIfTenantInfoDoesNotIncludeActiveTPD(tenantInfo[0], externalDirectoryOrgId); RmsUtil.ThrowIfTpdDoesNotIncludeKeyInformation(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId); RmsUtil.ThrowIfTpdDoesNotIncludeSLC(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId); RmsUtil.ThrowIfTpdDoesNotIncludeTemplates(tenantInfo[0].ActivePublishingDomain, externalDirectoryOrgId); RmsUtil.ThrowIfTenantInfoDoesNotIncludeLicensingUrls(tenantInfo[0], externalDirectoryOrgId); RmsUtil.ThrowIfTenantInfoDoesNotIncludeCertificationUrls(tenantInfo[0], externalDirectoryOrgId); this.IntranetLicensingUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].LicensingIntranetDistributionPointUrl); this.ExtranetLicensingUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].LicensingExtranetDistributionPointUrl); this.IntranetCertificationUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].CertificationIntranetDistributionPointUrl); this.ExtranetCertificationUrl = RMUtil.ConvertUriToLicenseLocationDistributionPoint(tenantInfo[0].CertificationExtranetDistributionPointUrl); result = RmsUtil.ConvertFromRmsOnlineTrustedDocDomain(tenantInfo[0].ActivePublishingDomain); } catch (FaultException <ArgumentException> innerException) { throw new ImportTpdException("Caught FaultException<ArgumentException> while obtaining TPD from RMS Online", innerException); } catch (CommunicationException innerException2) { throw new ImportTpdException("Unable to communicate with RMS Online key sharing web service", innerException2); } catch (TimeoutException innerException3) { throw new ImportTpdException("The TPD import request to the RMS Online key sharing web service has timed out", innerException3); } return(result); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); ((IConfigurationSession)base.DataSession).SessionSettings.IsSharedConfigChecked = true; bool flag = false; IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession, out flag); RMSTrustedPublishingDomain rmstrustedPublishingDomain = null; if (irmconfiguration == null) { base.WriteError(new FailedToAccessIrmConfigurationException(), (ErrorCategory)1002, this.Identity); } if (this.IntranetCertificationUrl != null) { this.DataObject.IntranetCertificationUrl = RMUtil.ConvertUriToCertificateLocationDistributionPoint(this.IntranetCertificationUrl); } if (this.ExtranetCertificationUrl != null) { this.DataObject.ExtranetCertificationUrl = RMUtil.ConvertUriToCertificateLocationDistributionPoint(this.ExtranetCertificationUrl); } if (this.IntranetLicensingUrl != null) { if (irmconfiguration.LicensingLocation.Contains(this.DataObject.IntranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(this.DataObject.IntranetLicensingUrl); } Uri uri = RMUtil.ConvertUriToLicenseLocationDistributionPoint(this.IntranetLicensingUrl); if (!irmconfiguration.LicensingLocation.Contains(uri)) { irmconfiguration.LicensingLocation.Add(uri); } this.DataObject.IntranetLicensingUrl = uri; } if (this.ExtranetLicensingUrl != null) { if (irmconfiguration.LicensingLocation.Contains(this.DataObject.ExtranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(this.DataObject.ExtranetLicensingUrl); } Uri uri2 = RMUtil.ConvertUriToLicenseLocationDistributionPoint(this.ExtranetLicensingUrl); if (!irmconfiguration.LicensingLocation.Contains(uri2)) { irmconfiguration.LicensingLocation.Add(uri2); } this.DataObject.ExtranetLicensingUrl = uri2; } if (this.Default && !this.DataObject.Default) { this.DataObject.Default = true; try { ImportRmsTrustedPublishingDomain.ChangeDefaultTPDAndUpdateIrmConfigData((IConfigurationSession)base.DataSession, irmconfiguration, this.DataObject, out rmstrustedPublishingDomain); irmconfiguration.ServerCertificatesVersion++; } catch (RightsManagementServerException ex) { base.WriteError(new FailedToGenerateSharedKeyException(ex), (ErrorCategory)1000, this.Identity); } } if (rmstrustedPublishingDomain != null) { this.WriteWarning(Strings.WarningChangeDefaultTPD(rmstrustedPublishingDomain.Name, this.DataObject.Name)); base.DataSession.Save(rmstrustedPublishingDomain); } base.DataSession.Save(irmconfiguration); base.InternalProcessRecord(); TaskLogger.LogExit(); }