public void Process(PipelineArgs args)
        {
            Log.Audit("Testing mongodb connection", this);

            var connectionStringSettings = ConfigurationManager.ConnectionStrings[_connectionStringName];

            if (connectionStringSettings == null)
            {
                Log.SingleError(string.Format("Unable to determine MongoDB status because connection string name '{0}' was not found in the web.config.", _connectionStringName), this);
                args.AbortPipeline();
                return;
            }

            var driver = new MongoDbDriver(connectionStringSettings.ConnectionString);

            try
            {
                if (driver.DatabaseAvailable)
                {
                    Log.Audit("Mongo Already running", this);
                    args.AbortPipeline();
                    return;
                }
            }
            catch {}

            Log.Audit("Mongo Not Running", this);
        }
    /// <summary>
    /// Processes the specified arguments.
    /// </summary>
    /// <param name="args">The arguments.</param>
    public virtual void Process(PipelineArgs args)
    {
      Assert.ArgumentNotNull(args, "args");

      ShoppingCart shoppingCart = Context.Entity.GetInstance<ShoppingCart>();
      PaymentProvider paymentProvider = Context.Entity.Resolve<PaymentProvider>(shoppingCart.PaymentSystem.Code);

      PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver();
      PaymentArgs paymentArgs = new PaymentArgs
      {
        ShoppingCart = shoppingCart,
        PaymentUrls = paymentUrlResolver.Resolve(),
      };

      StringBuilder description = new StringBuilder();
      foreach (ShoppingCartLine shoppingCartLine in shoppingCart.ShoppingCartLines)
      {
        description.Append(shoppingCartLine.Product.Title);
        description.Append(", ");
      }

      paymentArgs.Description = description.ToString().Trim().TrimEnd(',');

      paymentProvider.Invoke(shoppingCart.PaymentSystem, paymentArgs);

      args.AbortPipeline();
    }
Exemple #3
0
        /// <summary>
        /// Processes the specified arguments.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public virtual void Process(PipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            ShoppingCart    shoppingCart    = Context.Entity.GetInstance <ShoppingCart>();
            PaymentProvider paymentProvider = Context.Entity.Resolve <PaymentProvider>(shoppingCart.PaymentSystem.Code);

            PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver();
            PaymentArgs        paymentArgs        = new PaymentArgs
            {
                ShoppingCart = shoppingCart,
                PaymentUrls  = paymentUrlResolver.Resolve(),
            };

            StringBuilder description = new StringBuilder();

            foreach (ShoppingCartLine shoppingCartLine in shoppingCart.ShoppingCartLines)
            {
                description.Append(shoppingCartLine.Product.Title);
                description.Append(", ");
            }

            paymentArgs.Description = description.ToString().Trim().TrimEnd(',');

            paymentProvider.Invoke(shoppingCart.PaymentSystem, paymentArgs);

            args.AbortPipeline();
        }
 /// <summary>
 /// Call Item Import
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 public void Process(PipelineArgs args)
 {
     try
     {
         var operations = ExportQueueManager.GetAll();
         foreach (var operation in operations)
         {
             try
             {
                 MediaItemExportPipeline.Run(new MediaItemExportArgs {
                     Operation = operation
                 });
             }
             catch (Exception ex)
             {
                 LogHelper.Error("Error while exporting. Item Id:" + operation.Item.ID, this, ex);
             }
             finally
             {
                 ExportQueueManager.Remove(operation);
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error("Export data failed.", this, ex);
         args.AbortPipeline();
     }
 }
Exemple #5
0
 public void Process(PipelineArgs args)
 {
     if (HttpContext.Current.Request.Url.AbsolutePath.Contains("/scs/"))
     {
         args.AbortPipeline();
     }
 }
        public virtual void Process(PipelineArgs args)
        {
            var disableTrackingValue = WebUtil.GetQueryString(Constants.DisableTrackingParameterName);

            if (!string.IsNullOrEmpty(disableTrackingValue) &&
                disableTrackingValue.Equals(Settings.GetSetting(Constants.DisableTrackingParameterValueSetting, string.Empty)))
            {
                args.AbortPipeline();
            }
        }
        public virtual void Process(PipelineArgs args)
        {
            string filePath = Sitecore.Context.Request.FilePath.ToLower();

            foreach (var url in _urls)
            {
                if (filePath.Contains(url))
                {
                    args.AbortPipeline();
                }
            }
        }
Exemple #8
0
        public virtual void Process(PipelineArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");

            if (!HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Contains("scanalytics/registeranalyticsevent"))
            {
                args.AbortPipeline();
                if (Sitecore.Analytics.Tracker.IsActive)
                {
                    Sitecore.Analytics.Tracker.Current.Interaction.CurrentPage.Cancel();
                }
            }
        }
        public void Process(PipelineArgs args)
        {
            if (Aborted)
              {
            return;
              }

              Aborted = true;
              new Thread(() => CorePipeline.Run("initialize", new PipelineArgs())).Start();

              Log.Info("Aborting initialize pipeline to re-run it asynchronously", this);
              args.AbortPipeline();
        }
        public void Process(PipelineArgs args)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(args, "args");

            var key = Sitecore.Configuration.Settings.GetSetting("applicationInsightsInstrumentationKey");

            if (string.IsNullOrEmpty(key))
            {
                args.AbortPipeline();
                return;
            }

            Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = key;
        }
Exemple #11
0
        public virtual void Process(PipelineArgs args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            if (!this.ShouldExecute())
            {
                return;
            }

            if (this.ShouldDisableTracking())
            {
                args.AbortPipeline();
            }
        }
Exemple #12
0
        /// <summary>
        /// Process of the pipeline processor.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public virtual void Process(PipelineArgs args)
        {
            var arguments = (StartTrackingArgs)args;

            this.LoadExclusionList();

            var url = arguments.HttpContext.Request.Url;

            var foundUrl = _urlsToExclude.Find(u => url.AbsolutePath.IndexOf(u, StringComparison.OrdinalIgnoreCase) >= 0);

            if (!string.IsNullOrWhiteSpace(foundUrl))
            {
                args.AbortPipeline();
            }
        }
Exemple #13
0
        private void _process(PipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Profiler.StartOperation("Check security access to page.");

            if (!HasAccess() || Context.User.LocalName.ToLower().Equals("anonymous"))
            {
                CreateVirtualUserIfInternal();
            }

            if (!HasAccess())
            {
                args.AbortPipeline();
                var loginPage = GetLoginPage(Context.Site);
                if (loginPage.Length > 0)
                {
                    var urlString = new UrlString(loginPage);
                    if (Settings.Authentication.SaveRawUrl)
                    {
                        urlString.Append("url", HttpUtility.UrlEncode(Context.RawUrl));
                    }

                    var absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
                    if (!string.IsNullOrEmpty(absolutePath))
                    {
                        urlString["returnUrl"] = absolutePath;
                    }

                    Tracer.Info("Redirecting to login page \"" + loginPage + "\".");

                    WebUtil.Redirect(urlString.ToString(), false);
                }
                else
                {
                    Tracer.Info("Redirecting to error page as no login page was found.");
                    WebUtil.RedirectToErrorPage(
                        "Login is required, but no valid login page has been specified for the site (" + Context.Site.Name +
                        ").", false);
                }
            }

            Profiler.EndOperation();
        }
Exemple #14
0
        public void Process(PipelineArgs args)
        {
            if (!Settings.GetBoolSetting(VALIDATE_IOC_ENABLED, true))
            {
                return;
            }

            var serviceCollection = ServiceLocator.ServiceProvider.GetService <IServiceCollection>();

            if (serviceCollection == null)
            {
                return;
            }

            IoCLogger.Log.Info(string.Format("IoC Validation Started {0:g}", DateTime.Now));

            var result = new IoCMetaData();

            foreach (var service in serviceCollection)
            {
                var serviceType = service.ServiceType;
                if (result.ValidTypes.Any(p => p.ServiceType == serviceType.ToString()))
                {
                    continue;
                }

                try
                {
                    if (serviceType.ContainsGenericParameters)
                    {
                        result.NotValidatedTypes.Add(new ServiceMetaData {
                            ServiceType = serviceType.ToString(), Reason = CONTAINS_GENERIC_PARAMETER
                        });
                        continue;
                    }

                    var xs = ServiceLocator.ServiceProvider.GetServices(service.ServiceType);
                    foreach (var x in xs)
                    {
                        if (x == null)
                        {
                            continue;
                        }
                        result.ValidTypes.Add(
                            new ValidServiceMetaData {
                            ServiceType = serviceType.ToString(), ConcreteType = x.GetType().FullName
                        });

                        //Run External Tests
                        var validators = ServiceLocator.ServiceProvider.GetServices <IValidateIoCValidator>();
                        foreach (var validator in validators)
                        {
                            validator.Validate(x, result, serviceType);
                        }
                    }
                }
                catch (KeyNotFoundException)
                {
                    result.ValidTypes.Add(new ValidServiceMetaData {
                        ServiceType = serviceType.ToString()
                    });
                }
                catch (Exception e)
                {
                    result.Problems.Add(new ServiceMetaData {
                        ServiceType = serviceType.ToString(), Reason = e.Message
                    });
                }
            }

            var postProcessValidators = ServiceLocator.ServiceProvider.GetServices <IValidateIoCValidatorPostProcess>();

            foreach (var validator in postProcessValidators)
            {
                validator.Validate(result);
            }

            IoCLogger.Log.Info(JsonConvert.SerializeObject(result, Formatting.Indented));

            IoCLogger.Log.Info(string.Format("IoC Validation Finished {0:g}", DateTime.Now));

            if (Settings.GetBoolSetting(VALIDATE_IOC_HALT_APPLICATION, false))
            {
                var ignoredServices = Settings.GetSetting(VALIDATE_IOC_IGNORED_EXCEPTIONS, "").Split('|');
                if (result.Problems.Select(p => p.ServiceType).Except(ignoredServices).Any())
                {
                    args.AbortPipeline();
                    throw new ApplicationException("IoC Validation has failed and configuration is set to halt the application.  See IoC Logs for more info.");
                }
            }
        }