Skip to content

Commit

Permalink
Change type of Cdn3StorageManagerConfiguration.clientSecret to Secret…
Browse files Browse the repository at this point in the history
…String
  • Loading branch information
ravi-signal committed Jan 8, 2024
1 parent ba0c6be commit a62a6c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions service/config/sample-secrets-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ fcm.credentials: |
cdn.accessKey: test # AWS Access Key ID
cdn.accessSecret: test # AWS Access Secret

cdn3StorageManager.clientSecret: test

unidentifiedDelivery.certificate: ABCD1234
unidentifiedDelivery.privateKey: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789AAAAAAA

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Cdn3RemoteStorageManager(
// strip trailing "/" for easier URI construction
this.storageManagerBaseUrl = StringUtils.removeEnd(configuration.baseUri(), "/");
this.clientId = configuration.clientId();
this.clientSecret = configuration.clientSecret();
this.clientSecret = configuration.clientSecret().value();

// Client used to read/write to cdn
this.cdnHttpClient = FaultTolerantHttpClient.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package org.whispersystems.textsecuregcm.configuration;

import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
import javax.validation.constraints.NotNull;

public record Cdn3StorageManagerConfiguration(
String baseUri,
String clientId,
String clientSecret) {}
@NotNull String baseUri,
@NotNull String clientId,
@NotNull SecretString clientSecret) {}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.whispersystems.textsecuregcm.configuration.Cdn3StorageManagerConfiguration;
import org.whispersystems.textsecuregcm.configuration.CircuitBreakerConfiguration;
import org.whispersystems.textsecuregcm.configuration.RetryConfiguration;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
import org.whispersystems.textsecuregcm.util.CompletableFutureTestUtil;
import org.whispersystems.textsecuregcm.util.SystemMapper;
import org.whispersystems.textsecuregcm.util.TestRandomUtil;
Expand Down Expand Up @@ -71,7 +72,10 @@ public void init() throws CertificateException {
new CircuitBreakerConfiguration(),
new RetryConfiguration(),
Collections.emptyList(),
new Cdn3StorageManagerConfiguration(wireMock.url("storage-manager/"), "clientId", "clientSecret"));
new Cdn3StorageManagerConfiguration(
wireMock.url("storage-manager/"),
"clientId",
new SecretString("clientSecret")));

wireMock.stubFor(get(urlEqualTo("/cdn2/source/small"))
.willReturn(aResponse()
Expand Down

0 comments on commit a62a6c1

Please sign in to comment.