// 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.Facebook; namespace Microsoft.AspNet.Builder { /// /// Extension methods to add Facebook authentication capabilities to an HTTP application pipeline. /// public static class FacebookAppBuilderExtensions { /// /// Adds the middleware to the specified , which enables Facebook authentication capabilities. /// /// The to add the middleware to. /// An action delegate to configure the provided . /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new FacebookOptions(); configureOptions(options); return app.UseMiddleware(options); } /// /// Adds the middleware to the specified , which enables Facebook authentication capabilities. /// /// The to add the middleware to. /// A that specifies options for the middleware. /// A reference to this instance after the operation has completed. public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, FacebookOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return app.UseMiddleware(options); } } }