/// <summary>
        ///     Adds a middleware to the ASP.NET Core pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder" /> to which the middleware is added.</param>
        /// <returns>The <see cref="IApplicationBuilder" /> supplied in the app parameter.</returns>
        public static IApplicationBuilder UseRedirectValidation(this IApplicationBuilder app)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            var options = new RedirectValidationOptions();

            return(app.UseMiddleware <RedirectValidationMiddleware>(options));
        }
        /// <summary>
        ///     Adds a middleware to the ASP.NET Core pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder" /> to which the middleware is added.</param>
        /// <param name="configurer">An <see cref="Action" /> that configures the options for the middleware.</param>
        /// <returns>The <see cref="IApplicationBuilder" /> supplied in the app parameter.</returns>
        public static IApplicationBuilder UseRedirectValidation(this IApplicationBuilder app, Action <IFluentRedirectValidationOptions> configurer)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (configurer == null)
            {
                throw new ArgumentNullException(nameof(configurer));
            }

            var options = new RedirectValidationOptions();

            configurer(options);
            return(app.UseMiddleware <RedirectValidationMiddleware>(options));
        }
Example #3
0
 public RedirectValidationOptionsTests()
 {
     _options = new RedirectValidationOptions();
 }
 public RedirectValidationMiddleware(RequestDelegate next, RedirectValidationOptions options)
     : base(next)
 {
     _config            = options;
     _redirectValidator = new RedirectValidator();
 }
 public RedirectValidationMiddleware(AppFunc next, RedirectValidationOptions options)
     : base(next)
 {
     _config            = options;
     _redirectValidator = new RedirectValidator();
 }
Example #6
0
 public void Setup()
 {
     _options = new RedirectValidationOptions();
 }
 public void Setup()
 {
     _options = new RedirectValidationOptions();
 }
 public RedirectValidationMiddleware(AppFunc next, RedirectValidationOptions options)
     : base(next)
 {
     _config = options;
     _redirectValidator = new RedirectValidator();
 }