diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java index 7c2f82e52..83227408f 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountController.java @@ -21,7 +21,6 @@ import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.SharedMetricRegistries; import com.codahale.metrics.annotation.Timed; import com.google.common.annotations.VisibleForTesting; -import io.dropwizard.auth.Auth; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.whispersystems.textsecuregcm.auth.AuthenticationCredentials; @@ -84,6 +83,7 @@ import java.util.Optional; import java.util.UUID; import static com.codahale.metrics.MetricRegistry.name; +import io.dropwizard.auth.Auth; @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Path("/v1/accounts") @@ -299,7 +299,7 @@ public class AccountController { metricRegistry.meter(name(AccountController.class, "verify", Util.getCountryCode(number))).mark(); - return new AccountCreationResult(account.getUuid(), existingAccount.map(Account::isStorageSupported).orElse(false) ? existingBackupCredentials.orElse(null) : null); + return new AccountCreationResult(account.getUuid(), existingAccount.map(Account::isStorageSupported).orElse(false)); } catch (InvalidAuthorizationHeaderException e) { logger.info("Bad Authorization Header", e); throw new WebApplicationException(Response.status(401).build()); @@ -481,7 +481,7 @@ public class AccountController { @Path("/whoami") @Produces(MediaType.APPLICATION_JSON) public AccountCreationResult whoAmI(@Auth Account account) { - return new AccountCreationResult(account.getUuid(), backupServiceCredentialGenerator.generateFor(account.getUuid().toString())); + return new AccountCreationResult(account.getUuid(), account.isStorageSupported()); } @DELETE diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCreationResult.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCreationResult.java index 10811cfbf..38e70570d 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCreationResult.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/AccountCreationResult.java @@ -12,20 +12,20 @@ public class AccountCreationResult { private UUID uuid; @JsonProperty - private ExternalServiceCredentials backupCredentials; + private boolean storageCapable; public AccountCreationResult() {} - public AccountCreationResult(UUID uuid, ExternalServiceCredentials backupCredentials) { - this.uuid = uuid; - this.backupCredentials = backupCredentials; + public AccountCreationResult(UUID uuid, boolean storageCapable) { + this.uuid = uuid; + this.storageCapable = storageCapable; } public UUID getUuid() { return uuid; } - public ExternalServiceCredentials getBackupCredentials() { - return backupCredentials; + public boolean isStorageCapable() { + return storageCapable; } } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/AccountControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/AccountControllerTest.java index 4ca549d67..0620779e6 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/AccountControllerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/tests/controllers/AccountControllerTest.java @@ -502,7 +502,7 @@ public class AccountControllerTest { MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); assertThat(result.getUuid()).isNotNull(); - assertThat(result.getBackupCredentials()).isNull(); + assertThat(result.isStorageCapable()).isFalse(); verify(accountsManager, times(1)).create(isA(Account.class)); verify(directoryQueue, times(1)).deleteRegisteredUser(notNull(), eq(SENDER)); @@ -519,7 +519,7 @@ public class AccountControllerTest { MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); assertThat(result.getUuid()).isNotNull(); - assertThat(result.getBackupCredentials()).isNotNull(); + assertThat(result.isStorageCapable()).isTrue(); verify(accountsManager, times(1)).create(isA(Account.class)); verify(directoryQueue, times(1)).deleteRegisteredUser(notNull(), eq(SENDER_HAS_STORAGE));