public static IAppBuilder UseStackExchangeAuthentication(
     this IAppBuilder app,
     StackExchangeAuthenticationOptions options)
 {
     return UseAuthentication(
         typeof(OAuth2AuthenticationMiddleware<StackExchangeAuthenticationHandler, StackExchangeAuthenticationOptions>),
         app,
         options);
 }
        public static IAppBuilder UseStackExchangeAuthentication(
            this IAppBuilder app,
            string clientId,
            string clientSecret,
            string key,
            string site)
        {
            if (app == null)
            {
                throw new ArgumentNullException("app");
            }

            var option = new StackExchangeAuthenticationOptions(
                clientId,
                clientSecret,
                key,
                site)
            {
                SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType()
            };

            return UseStackExchangeAuthentication(app, option);
        }