// 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.Authentication.Cookies; using Microsoft.Framework.Internal; using Microsoft.Framework.OptionsModel; namespace Microsoft.AspNet.Builder { /// /// Extension methods provided by the cookies authentication middleware /// public static class CookieAppBuilderExtensions { /// /// Adds a cookie-based authentication middleware to your web application pipeline. /// /// The IApplicationBuilder passed to your configuration method /// Used to configure the options for the middleware /// The name of the options class that controls the middleware behavior, null will use the default options /// The original app parameter public static IApplicationBuilder UseCookieAuthentication([NotNull] this IApplicationBuilder app, Action configureOptions = null, string optionsName = "") { return app.UseMiddleware( new ConfigureOptions(configureOptions ?? (o => { })) { Name = optionsName }); } /// /// Adds a cookie-based authentication middleware to your web application pipeline. /// /// The IApplicationBuilder passed to your configuration method /// Used to configure the options for the middleware /// The name of the options class that controls the middleware behavior, null will use the default options /// The original app parameter public static IApplicationBuilder UseCookieAuthentication([NotNull] this IApplicationBuilder app, IOptions options) { return app.UseMiddleware(options, new ConfigureOptions(o => { })); } } }