// 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.Google; namespace Microsoft.AspNet.Builder { /// /// Extension methods for using . /// public static class GoogleAppBuilderExtensions { /// /// Authenticate users using Google OAuth 2.0. /// /// The passed to the configure method. /// The Middleware options. /// The updated . 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(options); } /// /// Authenticate users using Google OAuth 2.0. /// /// The passed to the configure method. /// Used to configure Middleware options. /// Name of the options instance to be used /// The updated . public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, Action configureOptions) { if (app == null) { throw new ArgumentNullException(nameof(app)); } var options = new GoogleOptions(); if (configureOptions != null) { configureOptions(options); } return app.UseGoogleAuthentication(options); } } }