using System;
using Microsoft.AspNet.Builder;
namespace Yavsc.Auth
{
///
/// Extension methods to add Google authentication capabilities to an HTTP application pipeline.
///
public static class GoogleAppBuilderExtensions
{
///
/// Adds the middleware to the specified , which enables Google authentication capabilities.
///
/// The to add the middleware to.
/// A reference to this instance after the operation has completed.
public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
return app.UseMiddleware();
}
///
/// Adds the middleware to the specified , which enables Google authentication capabilities.
///
/// The to add the middleware to.
/// A that specifies options for the middleware.
/// A reference to this instance after the operation has completed.
public static IApplicationBuilder UseGoogleAuthentication(this IApplicationBuilder app, YavscGoogleOptions options)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
return app.UseMiddleware(options);
}
}
}