diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/StickerController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/StickerController.java index f5210e258..bb6ea06e9 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/StickerController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/StickerController.java @@ -1,5 +1,6 @@ package org.whispersystems.textsecuregcm.controllers; +import io.dropwizard.auth.Auth; import org.whispersystems.textsecuregcm.entities.StickerPackFormUploadAttributes; import org.whispersystems.textsecuregcm.entities.StickerPackFormUploadAttributes.StickerPackFormUploadItem; import org.whispersystems.textsecuregcm.limits.RateLimiters; @@ -22,8 +23,6 @@ import java.time.ZonedDateTime; import java.util.LinkedList; import java.util.List; -import io.dropwizard.auth.Auth; - @Path("/v1/sticker") public class StickerController { @@ -60,7 +59,7 @@ public class StickerController { for (int i=0;i stickerPolicy = policyGenerator.createFor(now, stickerKey, 100155); + Pair stickerPolicy = policyGenerator.createFor(now, stickerKey, 307_200); String stickerSignature = policySigner.getSignature(now, stickerPolicy.second()); stickers.add(new StickerPackFormUploadItem(i, stickerKey, stickerPolicy.first(), "private", "AWS4-HMAC-SHA256", now.format(PostPolicyGenerator.AWS_DATE_TIME), stickerPolicy.second(), stickerSignature)); diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/StickerControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/StickerControllerTest.java index 93126137b..7c596c58f 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/StickerControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/StickerControllerTest.java @@ -1,6 +1,8 @@ package org.whispersystems.textsecuregcm.tests.controllers; import com.google.common.collect.ImmutableSet; +import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider; +import io.dropwizard.testing.junit.ResourceTestRule; import org.glassfish.jersey.test.grizzly.GrizzlyWebTestContainerFactory; import org.junit.Before; import org.junit.ClassRule; @@ -19,10 +21,12 @@ import org.whispersystems.textsecuregcm.util.SystemMapper; import javax.ws.rs.core.Response; import java.io.IOException; -import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider; -import io.dropwizard.testing.junit.ResourceTestRule; import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class StickerControllerTest { @@ -71,7 +75,7 @@ public class StickerControllerTest { assertThat(attributes.getStickers().get(i).getKey()).isEqualTo("stickers/" + attributes.getPackId() + "/full/" + i); assertThat(attributes.getStickers().get(i).getAcl()).isEqualTo("private"); assertThat(attributes.getStickers().get(i).getPolicy()).isNotEmpty(); - assertThat(new String(Base64.decode(attributes.getStickers().get(i).getPolicy()))).contains("[\"content-length-range\", 1, 100155]"); + assertThat(new String(Base64.decode(attributes.getStickers().get(i).getPolicy()))).contains("[\"content-length-range\", 1, 307200]"); assertThat(attributes.getStickers().get(i).getSignature()).isNotEmpty(); assertThat(attributes.getStickers().get(i).getAlgorithm()).isEqualTo("AWS4-HMAC-SHA256"); assertThat(attributes.getStickers().get(i).getCredential()).isNotEmpty();