// 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;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.OptionsModel;
using System;
namespace Microsoft.AspNet.Builder
{
///
/// Extension methods for using .
///
public static class GoogleAuthenticationExtensions
{
public static IServiceCollection ConfigureGoogleAuthentication([NotNull] this IServiceCollection services, [NotNull] Action configure)
{
return services.Configure(configure);
}
///
/// 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([NotNull] this IApplicationBuilder app, Action configureOptions = null, string optionsName = "")
{
return app.UseMiddleware(
new ConfigureOptions(configureOptions ?? (o => { }))
{
Name = optionsName
});
}
}
}