Ejemplo n.º 1
0
 private bool ValidateLoadTenantsIRMConfiguration(out IRMConfiguration irmConfiguration)
 {
     irmConfiguration = null;
     this.result.SetTask(Strings.InfoLoadIRMConfig);
     irmConfiguration = IRMConfiguration.Read(this.dataSession);
     return(this.result.SetSuccessResult(Strings.InfoIRMConfigLoaded));
 }
Ejemplo n.º 2
0
 private bool ValidateRmsOnlinePrerequisites(IRMConfiguration irmConfiguration)
 {
     this.result.SetTask(Strings.InfoCheckingRmsOnlinePrerequisites);
     if (!RmsUtil.AreRmsOnlinePreRequisitesMet(irmConfiguration))
     {
         return(this.result.SetFailureResult(Strings.ErrorRmsOnlinePrerequisites, null, true));
     }
     return(this.result.SetSuccessResult(Strings.InfoRmsOnlinePrerequisitesChecked));
 }
Ejemplo n.º 3
0
        protected override void InternalValidate()
        {
            base.InternalValidate();
            TransportRule dataObject = this.DataObject;

            if (dataObject == null)
            {
                ExAssert.RetailAssert(false, "EnableTransportRule.InternalValidate data object is invalid");
            }
            TransportRule rule  = (TransportRule)TransportRuleParser.Instance.GetRule(dataObject.Xml);
            Rule          rule2 = Rule.CreateFromInternalRule(TransportRulePredicate.GetAvailablePredicateMappings(), TransportRuleAction.GetAvailableActionMappings(), rule, dataObject.Priority, dataObject);
            IEnumerable <RightsProtectMessageAction> source = (from action in rule2.Actions
                                                               where action is RightsProtectMessageAction
                                                               select action as RightsProtectMessageAction).ToList <RightsProtectMessageAction>();

            if (source.Any <RightsProtectMessageAction>())
            {
                if (!RmsClientManager.IRMConfig.IsInternalLicensingEnabledForTenant(base.CurrentOrganizationId))
                {
                    base.WriteError(new IrmLicensingIsDisabledException(), ErrorCategory.InvalidArgument, null);
                }
                RmsTemplateIdentity     template = source.First <RightsProtectMessageAction>().Template;
                RmsTemplateDataProvider session  = new RmsTemplateDataProvider((IConfigurationSession)base.DataSession);
                base.GetDataObject <RmsTemplatePresentation>(new RmsTemplateIdParameter(template), session, null, new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotFound(template.TemplateName)), new LocalizedString?(Strings.OutlookProtectionRuleRmsTemplateNotUnique(template.TemplateName)));
            }
            bool flag;

            if (!rule2.Actions.Any((TransportRuleAction action) => action is ApplyOMEAction))
            {
                flag = rule2.Actions.Any((TransportRuleAction action) => action is RemoveOMEAction);
            }
            else
            {
                flag = true;
            }
            bool flag2 = flag;

            if (flag2)
            {
                IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession);
                if (irmconfiguration == null || !irmconfiguration.InternalLicensingEnabled)
                {
                    base.WriteError(new E4eLicensingIsDisabledExceptionEnableRule(), ErrorCategory.InvalidArgument, null);
                }
                if (RmsClientManager.IRMConfig.GetRmsTemplate(base.CurrentOrganizationId, RmsTemplate.InternetConfidential.Id) == null)
                {
                    base.WriteError(new E4eRuleRmsTemplateNotFoundException(RmsTemplate.InternetConfidential.Name), ErrorCategory.InvalidArgument, null);
                }
            }
        }
Ejemplo n.º 4
0
        private bool ValidateTpdSuitableForImport(IRMConfiguration irmConfiguration, TrustedDocDomain tpd, RmsOnlineTpdImporter tpdImporter)
        {
            this.result.SetTask(Strings.InfoCheckingTpdFromRmsOnline);
            TpdValidator tpdValidator = new TpdValidator(irmConfiguration.InternalLicensingEnabled, tpdImporter.IntranetLicensingUrl, tpdImporter.ExtranetLicensingUrl, tpdImporter.IntranetCertificationUrl, tpdImporter.ExtranetCertificationUrl, true, true, false);

            try
            {
                object obj;
                tpdValidator.ValidateTpdSuitableForImport(tpd, Strings.RmsOnline, out obj, null, null, null, null, null, null);
            }
            catch (LocalizedException ex)
            {
                return(this.result.SetFailureResult(Strings.ErrorTpdCheckingFailed, ex, true));
            }
            return(this.result.SetSuccessResult(Strings.InfoTpdFromRmsOnlineChecked));
        }
 public RmsTemplateDataProvider(IConfigurationSession adSession, RmsTemplateType typeToFetch, bool displayTemplatesIfInternalLicensingDisabled, RMSTrustedPublishingDomain trustedPublishingDomain)
 {
     if (adSession == null)
     {
         throw new ArgumentNullException("adSession");
     }
     if (adSession.SessionSettings == null)
     {
         throw new ArgumentNullException("adSession.SessionSettings");
     }
     this.adSession   = adSession;
     this.orgId       = adSession.SessionSettings.CurrentOrganizationId;
     this.typeToFetch = typeToFetch;
     this.displayTemplatesIfInternalLicensingDisabled = displayTemplatesIfInternalLicensingDisabled;
     this.irmConfiguration        = IRMConfiguration.Read(this.adSession);
     this.trustedPublishingDomain = trustedPublishingDomain;
 }
Ejemplo n.º 6
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            bool             flag             = false;
            IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession, out flag);

            if (irmconfiguration == null)
            {
                base.WriteError(new FailedToAccessIrmConfigurationException(), (ErrorCategory)1002, this.Identity);
            }
            if (base.DataObject.Default)
            {
                if (!this.Force && !base.ShouldContinue(Strings.RemoveDefaultTPD(this.Identity.ToString())))
                {
                    TaskLogger.LogExit();
                    return;
                }
                irmconfiguration.InternalLicensingEnabled   = false;
                irmconfiguration.SharedServerBoxRacIdentity = null;
                irmconfiguration.PublishingLocation         = null;
                irmconfiguration.ServiceLocation            = null;
                irmconfiguration.LicensingLocation          = null;
            }
            else
            {
                if (irmconfiguration.LicensingLocation.Contains(base.DataObject.IntranetLicensingUrl))
                {
                    irmconfiguration.LicensingLocation.Remove(base.DataObject.IntranetLicensingUrl);
                }
                if (irmconfiguration.LicensingLocation.Contains(base.DataObject.ExtranetLicensingUrl))
                {
                    irmconfiguration.LicensingLocation.Remove(base.DataObject.ExtranetLicensingUrl);
                }
            }
            base.DataSession.Save(irmconfiguration);
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
Ejemplo n.º 7
0
        private static string ReadOrganizationRacKeysFromIRMConfig(OrganizationId orgId)
        {
            ADSessionSettings sessionSettings   = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId);
            IRMConfiguration  irmConfiguration  = null;
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, sessionSettings, 1005, "ReadOrganizationRacKeysFromIRMConfig", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\OfflineRms\\ServerManager.cs");
                irmConfiguration = IRMConfiguration.Read(tenantOrTopologyConfigurationSession);
            }, 3);

            if (!adoperationResult.Succeeded)
            {
                throw new RightsManagementServerException(ServerStrings.FailedToReadIRMConfig(orgId.ToString()), adoperationResult.Exception, true);
            }
            if (irmConfiguration == null)
            {
                throw new RightsManagementServerException(ServerStrings.FailedToReadIRMConfig(orgId.ToString()), adoperationResult.Exception, true);
            }
            if (string.IsNullOrEmpty(irmConfiguration.SharedServerBoxRacIdentity))
            {
                throw new RightsManagementServerException(ServerStrings.FailedToReadSharedServerBoxRacIdentityFromIRMConfig(orgId.ToString()), adoperationResult.Exception, true);
            }
            return(irmConfiguration.SharedServerBoxRacIdentity);
        }
Ejemplo n.º 8
0
 public static bool AreRmsOnlinePreRequisitesMet(IRMConfiguration irmConfiguration)
 {
     RmsUtil.ThrowIfParameterNull(irmConfiguration, "irmConfiguration");
     return(RMUtil.IsWellFormedRmServiceUrl(irmConfiguration.RMSOnlineKeySharingLocation));
 }
Ejemplo n.º 9
0
        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();
        }