diff --git a/core/src/main/java/google/registry/config/RegistryConfig.java b/core/src/main/java/google/registry/config/RegistryConfig.java index c1566592b..7e994a921 100644 --- a/core/src/main/java/google/registry/config/RegistryConfig.java +++ b/core/src/main/java/google/registry/config/RegistryConfig.java @@ -28,6 +28,7 @@ import com.google.common.base.Ascii; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedMap; import dagger.Module; @@ -1390,6 +1391,24 @@ public final class RegistryConfig { return config.bulkPricingPackageMonitoring.bulkPricingPackageDomainLimitUpgradeEmailBody; } + @Provides + @Config("bsaAuthUrl") + public static String provideBsaAuthUrl(RegistryConfigSettings config) { + return config.bsa.authUrl; + } + + @Provides + @Config("bsaAuthTokenExpiry") + public static Duration provideBsaAuthTokenExpiry(RegistryConfigSettings config) { + return Duration.standardSeconds(config.bsa.authTokenExpirySeconds); + } + + @Provides + @Config("bsaDataUrls") + public static ImmutableMap provideBsaDataUrls(RegistryConfigSettings config) { + return ImmutableMap.copyOf(config.bsa.dataUrls); + } + private static String formatComments(String text) { return Splitter.on('\n').omitEmptyStrings().trimResults().splitToList(text).stream() .map(s -> "# " + s) diff --git a/core/src/main/java/google/registry/config/RegistryConfigSettings.java b/core/src/main/java/google/registry/config/RegistryConfigSettings.java index 8d62a0a53..cd9dc3c39 100644 --- a/core/src/main/java/google/registry/config/RegistryConfigSettings.java +++ b/core/src/main/java/google/registry/config/RegistryConfigSettings.java @@ -43,6 +43,7 @@ public class RegistryConfigSettings { public ContactHistory contactHistory; public DnsUpdate dnsUpdate; public BulkPricingPackageMonitoring bulkPricingPackageMonitoring; + public Bsa bsa; /** Configuration options that apply to the entire GCP project. */ public static class GcpProject { @@ -261,4 +262,11 @@ public class RegistryConfigSettings { public String bulkPricingPackageDomainLimitUpgradeEmailSubject; public String bulkPricingPackageDomainLimitUpgradeEmailBody; } + + /** Configurations for integration with Brand Safety Alliance (BSA) API. */ + public static class Bsa { + public String authUrl; + public int authTokenExpirySeconds; + public Map dataUrls; + } } diff --git a/core/src/main/java/google/registry/config/files/default-config.yaml b/core/src/main/java/google/registry/config/files/default-config.yaml index 17dce56b5..21cbc840a 100644 --- a/core/src/main/java/google/registry/config/files/default-config.yaml +++ b/core/src/main/java/google/registry/config/files/default-config.yaml @@ -598,3 +598,14 @@ bulkPricingPackageMonitoring: Registrar: %3$s Active Domain Limit: %4$s Current Active Domains: %5$s + +# Configurations for integration with Brand Safety Alliance (BSA) API +bsa: + # Http endpoint for acquiring Auth tokens. + authUrl: "https://" + # Auth token expiry. + authTokenExpirySeconds: 1800 + # Http endpoints for downloading data + dataUrls: + "BLOCK": "https://" + "BLOCK_PLUS": "https://"