/// <summary>
 /// Authenticate users using Facebook.
 /// </summary>
 /// <param name="app">The <see cref="IApplicationBuilder"/> passed to the configure method.</param>
 /// <param name="configureOptions">Configures the options.</param>
 /// <returns>The updated <see cref="IApplicationBuilder"/>.</returns>
 public static IApplicationBuilder UseFacebookAuthentication([NotNull] this IApplicationBuilder app, Action<FacebookOptions> configureOptions)
 {
     var options = new FacebookOptions();
     if (configureOptions != null)
     {
         configureOptions(options);
     }
     return app.UseFacebookAuthentication(options);
 }
 public MultiTenantFacebookOptionsResolver(
     FacebookOptions originalOptions,
     ISiteResolver siteResolver,
     ISiteRepository siteRepository,
     MultiTenantOptions multiTenantOptions)
 {
     this.originalOptions = originalOptions;
     this.siteResolver = siteResolver;
     this.multiTenantOptions = multiTenantOptions;
     siteRepo = siteRepository;
 }
        /// <summary>
        /// Adds the <see cref="FacebookMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables Facebook authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="configureOptions">An action delegate to configure the provided <see cref="FacebookOptions"/>.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseFacebookAuthentication(this IApplicationBuilder app, Action<FacebookOptions> configureOptions)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            var options = new FacebookOptions();
            if (configureOptions != null)
            {
                configureOptions(options);
            }
            return app.UseFacebookAuthentication(options);
        }
        /// <summary>
        /// Adds the <see cref="FacebookMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables Facebook authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="FacebookOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        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<FacebookMiddleware>(options);
        }
 public MultiTenantFacebookOptionsResolver(
     FacebookOptions originalOptions,
     //ISiteResolver siteResolver,
     //IHttpContextAccessor contextAccessor,
     //ITenantResolver<SiteSettings> siteResolver,
     ISiteSettings currentSite,
     //ISiteRepository siteRepository,
     MultiTenantOptions multiTenantOptions)
 {
     this.originalOptions = originalOptions;
     //this.siteResolver = siteResolver;
     //this.contextAccessor = contextAccessor;
     this.multiTenantOptions = multiTenantOptions;
     //siteRepo = siteRepository;
     site = currentSite;
 }
        public static IApplicationBuilder UseMultiTenantFacebookAuthentication(
            this IApplicationBuilder app, 
            Action<FacebookOptions> configureOptions)
        {
            //https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNet.Authentication.Facebook/FacebookOptions.cs
            // https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNet.Authentication.OAuth/OAuthOptions.cs

            var options = new FacebookOptions();
            if (configureOptions != null)
            {
                configureOptions(options);
            }

            return app.UseMiddleware<MultiTenantFacebookMiddleware>(options);
        }