public static IAppBuilder UseRecaptchaForAuthenticationRequests(this IAppBuilder app,
                                                                        IdentityServerRecaptchaOptions options,
                                                                        Func <IRecaptchaValidationService> recaptchaValidationService)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (recaptchaValidationService == null)
            {
                recaptchaValidationService = () => new DefaultRecaptchaValidationService();
            }

            app.UseRequestedChallengeType(options);

            app.UsePerOwinContext(recaptchaValidationService);
            app.Use <ValidateRecaptchaChallenge>(options);
            app.Use <ChallengeEveryoneMiddleware>(options);
            app.Use <ChallengeByIp>(options);

            return(app);
        }
 public static IAppBuilder UseRecaptchaForAuthenticationRequests(this IAppBuilder app,
                                                                 IdentityServerRecaptchaOptions options)
 {
     return(app.UseRecaptchaForAuthenticationRequests(options,
                                                      () => new DefaultRecaptchaValidationService()));
 }