/// <summary>
        /// Adds the <see cref="CookiePolicyMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables cookie policy capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="CookiePolicyOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return app.UseMiddleware<CookiePolicyMiddleware>(Options.Create(options));
        }
Example #2
0
        /// <summary>
        /// Adds the <see cref="CookiePolicyMiddleware"/> handler to the specified <see cref="IApplicationBuilder"/>, which enables cookie policy capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the handler to.</param>
        /// <param name="options">A <see cref="CookiePolicyOptions"/> that specifies options for the handler.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <CookiePolicyMiddleware>(Options.Create(options)));
        }
Example #3
0
 public CookiesWrapper(HttpContext context, CookiePolicyOptions options, IResponseCookiesFeature feature)
 {
     Context = context;
     Feature = feature;
     Policy = options;
 }
Example #4
0
 public CookiesWrapperFeature(HttpContext context, CookiePolicyOptions options, IResponseCookiesFeature feature)
 {
     Wrapper = new CookiesWrapper(context, options, feature);
 }
Example #5
0
 private async Task RunTest(
     string path,
     CookiePolicyOptions cookiePolicy,
     RequestDelegate configureSetup,
     params RequestTest[] tests)
 {
     var builder = new WebHostBuilder()
         .Configure(app =>
         {
             app.Map(path, map =>
             {
                 map.UseCookiePolicy(cookiePolicy);
                 map.Run(configureSetup);
             });
         });
     var server = new TestServer(builder);
     foreach (var test in tests)
     {
         await test.Execute(server);
     }
 }
 public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options)
 {
     throw null;
 }