Add by-action captcha score config

Enable setting different captcha score thresholds for different captcha
actions via configuration
This commit is contained in:
Ravi Khadiwala
2023-02-28 10:21:59 -06:00
committed by ravi-signal
parent 437bc1358b
commit 59bc2c5535
4 changed files with 22 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
@@ -28,6 +29,11 @@ public class DynamicCaptchaConfiguration {
@JsonProperty
private boolean allowRecaptcha = true;
@JsonProperty
@NotNull
private Map<String, BigDecimal> scoreFloorByAction = Collections.emptyMap();
@JsonProperty
@NotNull
private Set<String> signupCountryCodes = Collections.emptySet();
@@ -66,6 +72,10 @@ public class DynamicCaptchaConfiguration {
return allowRecaptcha;
}
public Map<String, BigDecimal> getScoreFloorByAction() {
return scoreFloorByAction;
}
@VisibleForTesting
public void setAllowHCaptcha(final boolean allowHCaptcha) {
this.allowHCaptcha = allowHCaptcha;