From b0667b258bc64673d3164b6eccc1f1b70ce25fe4 Mon Sep 17 00:00:00 2001 From: Ehren Kret Date: Fri, 30 Jul 2021 15:04:16 -0700 Subject: [PATCH] Implement EnterpriseRecaptchaClient --- .../WhisperServerConfiguration.java | 14 +++++- .../textsecuregcm/WhisperServerService.java | 6 ++- .../RecaptchaV2Configuration.java | 42 ++++++++++++++++++ .../recaptcha/EnterpriseRecaptchaClient.java | 44 ++++++++++++++++++- 4 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 service/src/main/java/org/whispersystems/textsecuregcm/configuration/RecaptchaV2Configuration.java diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java index 4f5a671c7..9ae4ddd29 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java @@ -31,22 +31,23 @@ import org.whispersystems.textsecuregcm.configuration.GcpAttachmentsConfiguratio import org.whispersystems.textsecuregcm.configuration.MaxDeviceConfiguration; import org.whispersystems.textsecuregcm.configuration.MessageCacheConfiguration; import org.whispersystems.textsecuregcm.configuration.MessageDynamoDbConfiguration; -import org.whispersystems.textsecuregcm.configuration.WavefrontConfiguration; +import org.whispersystems.textsecuregcm.configuration.MonitoredS3ObjectConfiguration; import org.whispersystems.textsecuregcm.configuration.PaymentsServiceConfiguration; import org.whispersystems.textsecuregcm.configuration.PushConfiguration; import org.whispersystems.textsecuregcm.configuration.RateLimitsConfiguration; import org.whispersystems.textsecuregcm.configuration.RecaptchaConfiguration; +import org.whispersystems.textsecuregcm.configuration.RecaptchaV2Configuration; import org.whispersystems.textsecuregcm.configuration.RedisClusterConfiguration; import org.whispersystems.textsecuregcm.configuration.RedisConfiguration; import org.whispersystems.textsecuregcm.configuration.RemoteConfigConfiguration; import org.whispersystems.textsecuregcm.configuration.SecureBackupServiceConfiguration; import org.whispersystems.textsecuregcm.configuration.SecureStorageServiceConfiguration; import org.whispersystems.textsecuregcm.configuration.TestDeviceConfiguration; -import org.whispersystems.textsecuregcm.configuration.MonitoredS3ObjectConfiguration; import org.whispersystems.textsecuregcm.configuration.TurnConfiguration; import org.whispersystems.textsecuregcm.configuration.TwilioConfiguration; import org.whispersystems.textsecuregcm.configuration.UnidentifiedDeliveryConfiguration; import org.whispersystems.textsecuregcm.configuration.VoiceVerificationConfiguration; +import org.whispersystems.textsecuregcm.configuration.WavefrontConfiguration; import org.whispersystems.textsecuregcm.configuration.ZkConfig; import org.whispersystems.websocket.configuration.WebSocketConfiguration; @@ -253,6 +254,11 @@ public class WhisperServerConfiguration extends Configuration { @JsonProperty private RecaptchaConfiguration recaptcha; + @Valid + @NotNull + @JsonProperty + private RecaptchaV2Configuration recaptchaV2; + @Valid @NotNull @JsonProperty @@ -304,6 +310,10 @@ public class WhisperServerConfiguration extends Configuration { return recaptcha; } + public RecaptchaV2Configuration getRecaptchaV2Configuration() { + return recaptchaV2; + } + public VoiceVerificationConfiguration getVoiceVerificationConfiguration() { return voiceVerification; } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 75bcc2561..c19354acb 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -469,7 +469,11 @@ public class WhisperServerService extends Application= scoreFloor; } }