Skip to content

Instantly share code, notes, and snippets.

@weedkiller
Forked from willerup/sample.cs
Created January 25, 2017 22:03
Show Gist options
  • Save weedkiller/213a205a039156994bfd9abf10f454e6 to your computer and use it in GitHub Desktop.
Save weedkiller/213a205a039156994bfd9abf10f454e6 to your computer and use it in GitHub Desktop.
intuit1
public sealed class IntuitAuthenticationOptions : OpenIDAuthenticationOptions
{
public const string FirstName = "intuit.firstname";
public const string LastName = "intuit.lastname";
public const string Email = "intuit.email";
public IntuitAuthenticationOptions()
{
ProviderDiscoveryUri = "https://openid.intuit.com/openid/xrds";
Caption = "Intuit";
AuthenticationType = "Intuit";
CallbackPath = new PathString("/signin-intuit");
}
}
public static class IntuitAuthenticationExtensions
{
public static IAppBuilder UseIntuitAuthentication(this IAppBuilder app, IntuitAuthenticationOptions options)
{
if (app == null) throw new ArgumentNullException("app");
if (options == null) throw new ArgumentNullException("options");
return app.Use(typeof(IntuitAuthenticationMiddleware), app, options);
}
public static IAppBuilder UseIntuitAuthentication(this IAppBuilder app)
{
return UseIntuitAuthentication(app, new IntuitAuthenticationOptions());
}
}
internal sealed class IntuitAuthenticationHandler : OpenIDAuthenticationHandlerBase
{
public IntuitAuthenticationHandler(HttpClient httpClient, ILogger logger)
: base(httpClient, logger)
{ }
}
public sealed class IntuitAuthenticationMiddleware : OpenIDAuthenticationMiddlewareBase
{
public IntuitAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app, IntuitAuthenticationOptions options)
: base(next, app, options)
{ }
protected override AuthenticationHandler CreateSpecificHandler()
{
return new IntuitAuthenticationHandler(_httpClient, _logger);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment