/// <summary>
 /// Authenticate users using Google OAuth 2.0.
 /// </summary>
 /// <param name="app">The <see cref="IApplicationBuilder"/> passed to the configure method.</param>
 /// <param name="configureOptions">Used to configure Middleware options.</param>
 /// <param name="optionsName">Name of the options instance to be used</param>
 /// <returns>The updated <see cref="IApplicationBuilder"/>.</returns>
 public static IApplicationBuilder UseGoogleAuthentication([NotNull] this IApplicationBuilder app, Action<GoogleOptions> configureOptions)
 {
     var options = new GoogleOptions();
     if (configureOptions != null)
     {
         configureOptions(options);
     }
     return app.UseGoogleAuthentication(options);
 }
 public MultiTenantGoogleOptionsResolver(
     GoogleOptions originalOptions,
     ISiteResolver siteResolver,
     ISiteRepository siteRepository,
     MultiTenantOptions multiTenantOptions)
 {
     this.originalOptions = originalOptions;
     this.siteResolver = siteResolver;
     this.multiTenantOptions = multiTenantOptions;
     siteRepo = siteRepository;
 }
 public MultiTenantGoogleOptionsResolver(
     GoogleOptions originalOptions,
     //ISiteResolver siteResolver,
     //ISiteRepository siteRepository,
     ISiteSettings currentSite,
     MultiTenantOptions multiTenantOptions)
 {
     this.originalOptions = originalOptions;
     //this.siteResolver = siteResolver;
     this.multiTenantOptions = multiTenantOptions;
     //siteRepo = siteRepository;
     site = currentSite;
 }
        /// <summary>
        /// Adds the <see cref="GoogleMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables Google 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="GoogleOptions"/>.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, Action<GoogleOptions> configureOptions)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            var options = new GoogleOptions();
            if (configureOptions != null)
            {
                configureOptions(options);
            }
            return app.UseGoogleAuthentication(options);
        }
        /// <summary>
        /// Adds the <see cref="GoogleMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables Google authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="GoogleOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, GoogleOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return app.UseMiddleware<GoogleMiddleware>(options);
        }
        public static IApplicationBuilder UseMultiTenantGoogleAuthentication(
            this IApplicationBuilder app, 
            Action<GoogleOptions> configureOptions)
        {
            //https://github.com/aspnet/Security/blob/582f562bbb20fc76f37023086e2b2d861eb4d43d/src/Microsoft.AspNet.Authentication.Google/GoogleOptions.cs
            //https://github.com/aspnet/Security/blob/582f562bbb20fc76f37023086e2b2d861eb4d43d/src/Microsoft.AspNet.Authentication.Google/GoogleDefaults.cs

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

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