Пример #1
0
        /// <summary>
        ///     Adds a middleware to the OWIN pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder" /> to which the middleware is added.</param>
        /// <returns>The <see cref="IAppBuilder" /> supplied in the app parameter.</returns>
        public static IAppBuilder UseRedirectValidation(this IAppBuilder app)
        {
            if (app == null) throw new ArgumentNullException("app");

            var options = new RedirectValidationOptions();
            return app.Use(typeof(RedirectValidationMiddleware), options);
        }
Пример #2
0
        /// <summary>
        ///     Adds a middleware to the OWIN pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder" /> 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="IAppBuilder" /> supplied in the app parameter.</returns>
        public static IAppBuilder UseRedirectValidation(this IAppBuilder app, Action<IFluentRedirectValidationOptions> configurer)
        {
            if (app == null) throw new ArgumentNullException("app");
            if (configurer == null) throw new ArgumentNullException("configurer");

            var options = new RedirectValidationOptions();
            configurer(options);
            return app.Use(typeof(RedirectValidationMiddleware), options);
        }
Пример #3
0
        /// <summary>
        ///     Adds a middleware to the OWIN pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder" /> to which the middleware is added.</param>
        /// <returns>The <see cref="IAppBuilder" /> supplied in the app parameter.</returns>
        public static IAppBuilder UseRedirectValidation(this IAppBuilder app)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }

            var options = new RedirectValidationOptions();

            return(app.Use(typeof(RedirectValidationMiddleware), options));
        }
Пример #4
0
        /// <summary>
        ///     Adds a middleware to the OWIN pipeline that validates redirects.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder" /> 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="IAppBuilder" /> supplied in the app parameter.</returns>
        public static IAppBuilder UseRedirectValidation(this IAppBuilder app, Action <IFluentRedirectValidationOptions> configurer)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }
            if (configurer == null)
            {
                throw new ArgumentNullException("configurer");
            }

            var options = new RedirectValidationOptions();

            configurer(options);
            return(app.Use(typeof(RedirectValidationMiddleware), options));
        }