// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Security.Google; namespace Microsoft.AspNet.Builder { /// /// Extension methods for using . /// public static class GoogleAuthenticationExtensions { /// /// Authenticate users using Google OAuth 2.0. /// /// The passed to the configure method. /// The google assigned client id. /// The google assigned client secret. /// The updated . public static IBuilder UseGoogleAuthentication([NotNull] this IBuilder app, [NotNull] string clientId, [NotNull] string clientSecret) { return app.UseGoogleAuthentication( new GoogleAuthenticationOptions { ClientId = clientId, ClientSecret = clientSecret }); } /// /// Authenticate users using Google OAuth 2.0. /// /// The passed to the configure method. /// Middleware configuration options. /// The updated . public static IBuilder UseGoogleAuthentication([NotNull] this IBuilder app, [NotNull] GoogleAuthenticationOptions options) { if (string.IsNullOrEmpty(options.SignInAsAuthenticationType)) { options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType(); } return app.UseMiddleware(options); } } }