45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
namespace Owin.Security.Providers.Shopify
|
|
{
|
|
using System;
|
|
|
|
public static class ShopifyAuthenticationExtensions
|
|
{
|
|
/// <summary>
|
|
/// Use Shopify Shop OAuth authentication.
|
|
/// </summary>
|
|
/// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
|
|
/// <param name="options">Shopify overrided authentication options.</param>
|
|
/// <returns>Returns instance of <see cref="IAppBuilder"/>.</returns>
|
|
public static IAppBuilder UseShopifyAuthentication(this IAppBuilder app, ShopifyAuthenticationOptions options)
|
|
{
|
|
if (null == app)
|
|
{
|
|
throw new ArgumentNullException(nameof(app));
|
|
}
|
|
|
|
if (null == options)
|
|
{
|
|
throw new ArgumentNullException(nameof(options));
|
|
}
|
|
|
|
app.Use(typeof(ShopifyAuthenticationMiddleware), app, options);
|
|
return app;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Use Shopify Shop OAuth authentication with default authentication options.
|
|
/// </summary>
|
|
/// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
|
|
/// <param name="apiKey">Shopify App - API key.</param>
|
|
/// <param name="apiSecret">Shopify App - API secret.</param>
|
|
/// <returns>Returns instance of <see cref="IAppBuilder"/>.</returns>
|
|
public static IAppBuilder UseShopifyAuthentication(this IAppBuilder app, string apiKey, string apiSecret)
|
|
{
|
|
return app.UseShopifyAuthentication(new ShopifyAuthenticationOptions
|
|
{
|
|
ApiKey = apiKey,
|
|
ApiSecret = apiSecret
|
|
});
|
|
}
|
|
}
|
|
} |