All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mkopylec.recaptcha.testing.TestingConfiguration Maven / Gradle / Ivy

There is a newer version: 2.3.1
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy