// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.CookiePolicy;
namespace Microsoft.AspNet.Builder
{
///
/// Extension methods provided by the cookie policy middleware
///
public static class CookiePolicyAppBuilderExtensions
{
///
/// Adds a cookie policy middleware to your web application pipeline.
///
/// The IApplicationBuilder passed to your configuration method
/// The options for the middleware
/// The original app parameter
public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, CookiePolicyOptions options)
{
return app.UseMiddleware(options);
}
///
/// Adds a cookie policy middleware to your web application pipeline.
///
/// The IApplicationBuilder passed to your configuration method
/// Used to configure the options for the middleware
/// The original app parameter
public static IApplicationBuilder UseCookiePolicy(this IApplicationBuilder app, Action configureOptions)
{
var options = new CookiePolicyOptions();
if (configureOptions != null)
{
configureOptions(options);
}
return app.UseCookiePolicy(options);
}
}
}