com.github.mkopylec.recaptcha.testing.TestingConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of recaptcha-spring-boot-starter Show documentation
Show all versions of recaptcha-spring-boot-starter Show documentation
Spring Boot starter for Google's reCAPTCHA
package com.github.mkopylec.recaptcha.testing;
import com.github.mkopylec.recaptcha.RecaptchaProperties;
import com.github.mkopylec.recaptcha.validation.RecaptchaValidator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration("recaptchaTestingConfiguration")
@EnableConfigurationProperties(RecaptchaProperties.class)
@ConditionalOnProperty(name = "recaptcha.testing.enabled")
public class TestingConfiguration {
private final RecaptchaProperties recaptcha;
public TestingConfiguration(RecaptchaProperties recaptcha) {
this.recaptcha = recaptcha;
}
@Bean
@ConditionalOnMissingBean
public RecaptchaValidator userResponseValidator() {
return new TestRecaptchaValidator(recaptcha);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy