Remove payments list from Account

This commit is contained in:
Ehren Kret 2021-02-19 11:44:59 -06:00
parent aa8525385a
commit 93f845610d
10 changed files with 46 additions and 269 deletions

View File

@ -65,7 +65,6 @@ import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.Device; import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.storage.MessagesManager; import org.whispersystems.textsecuregcm.storage.MessagesManager;
import org.whispersystems.textsecuregcm.storage.PaymentAddressList;
import org.whispersystems.textsecuregcm.storage.PendingAccountsManager; import org.whispersystems.textsecuregcm.storage.PendingAccountsManager;
import org.whispersystems.textsecuregcm.storage.UsernamesManager; import org.whispersystems.textsecuregcm.storage.UsernamesManager;
import org.whispersystems.textsecuregcm.util.Constants; import org.whispersystems.textsecuregcm.util.Constants;
@ -473,7 +472,6 @@ public class AccountController {
account.setUnidentifiedAccessKey(attributes.getUnidentifiedAccessKey()); account.setUnidentifiedAccessKey(attributes.getUnidentifiedAccessKey());
account.setUnrestrictedUnidentifiedAccess(attributes.isUnrestrictedUnidentifiedAccess()); account.setUnrestrictedUnidentifiedAccess(attributes.isUnrestrictedUnidentifiedAccess());
account.setPayments(attributes.getPayments());
account.setDiscoverableByPhoneNumber(attributes.isDiscoverableByPhoneNumber()); account.setDiscoverableByPhoneNumber(attributes.isDiscoverableByPhoneNumber());
accounts.update(account); accounts.update(account);
@ -527,16 +525,6 @@ public class AccountController {
return Response.ok().build(); return Response.ok().build();
} }
@Timed
@PUT
@Path("/payments")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public void setPayments(@Auth Account account, @Valid PaymentAddressList payments) {
account.setPayments(payments.getPayments());
accounts.update(account);
}
private CaptchaRequirement requiresCaptcha(String number, String transport, String forwardedFor, private CaptchaRequirement requiresCaptcha(String number, String transport, String forwardedFor,
String requester, String requester,
Optional<String> captchaToken, Optional<String> captchaToken,
@ -641,7 +629,6 @@ public class AccountController {
setAccountRegistrationLockFromAttributes(account, accountAttributes); setAccountRegistrationLockFromAttributes(account, accountAttributes);
account.setUnidentifiedAccessKey(accountAttributes.getUnidentifiedAccessKey()); account.setUnidentifiedAccessKey(accountAttributes.getUnidentifiedAccessKey());
account.setUnrestrictedUnidentifiedAccess(accountAttributes.isUnrestrictedUnidentifiedAccess()); account.setUnrestrictedUnidentifiedAccess(accountAttributes.isUnrestrictedUnidentifiedAccess());
account.setPayments(accountAttributes.getPayments());
account.setDiscoverableByPhoneNumber(accountAttributes.isDiscoverableByPhoneNumber()); account.setDiscoverableByPhoneNumber(accountAttributes.isDiscoverableByPhoneNumber());
if (accounts.create(account)) { if (accounts.create(account)) {

View File

@ -217,8 +217,7 @@ public class ProfileController {
new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()), new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()),
username.orElse(null), username.orElse(null),
null, null,
credential.orElse(null), credential.orElse(null)));
accountProfile.get().getPayments()));
} catch (InvalidInputException e) { } catch (InvalidInputException e) {
logger.info("Bad profile request", e); logger.info("Bad profile request", e);
throw new WebApplicationException(Response.Status.BAD_REQUEST); throw new WebApplicationException(Response.Status.BAD_REQUEST);
@ -258,8 +257,7 @@ public class ProfileController {
new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()), new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()),
username, username,
accountProfile.get().getUuid(), accountProfile.get().getUuid(),
null, null);
accountProfile.get().getPayments());
} }
private Optional<ProfileKeyCredentialResponse> getProfileCredential(Optional<String> encodedProfileCredentialRequest, private Optional<ProfileKeyCredentialResponse> getProfileCredential(Optional<String> encodedProfileCredentialRequest,
@ -334,8 +332,7 @@ public class ProfileController {
new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()), new UserCapabilities(accountProfile.get().isGroupsV2Supported(), accountProfile.get().isGv1MigrationSupported()),
username.orElse(null), username.orElse(null),
null, null,
null, null);
accountProfile.get().getPayments());
} }

View File

@ -6,10 +6,8 @@ package org.whispersystems.textsecuregcm.entities;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import java.util.List;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import org.whispersystems.textsecuregcm.storage.Device.DeviceCapabilities; import org.whispersystems.textsecuregcm.storage.Device.DeviceCapabilities;
import org.whispersystems.textsecuregcm.storage.PaymentAddress;
public class AccountAttributes { public class AccountAttributes {
@ -35,9 +33,6 @@ public class AccountAttributes {
@JsonProperty @JsonProperty
private boolean unrestrictedUnidentifiedAccess; private boolean unrestrictedUnidentifiedAccess;
@JsonProperty
private List<PaymentAddress> payments;
@JsonProperty @JsonProperty
private DeviceCapabilities capabilities; private DeviceCapabilities capabilities;
@ -47,20 +42,14 @@ public class AccountAttributes {
public AccountAttributes() {} public AccountAttributes() {}
@VisibleForTesting @VisibleForTesting
public AccountAttributes(boolean fetchesMessages, int registrationId, String pin) { public AccountAttributes(boolean fetchesMessages, int registrationId, String name, String pin, String registrationLock, boolean discoverableByPhoneNumber, final DeviceCapabilities capabilities) {
this(fetchesMessages, registrationId, null, pin, null, null, true, null); this.fetchesMessages = fetchesMessages;
} this.registrationId = registrationId;
this.name = name;
@VisibleForTesting this.pin = pin;
public AccountAttributes(boolean fetchesMessages, int registrationId, String name, String pin, String registrationLock, List<PaymentAddress> payments, boolean discoverableByPhoneNumber, final DeviceCapabilities capabilities) { this.registrationLock = registrationLock;
this.fetchesMessages = fetchesMessages;
this.registrationId = registrationId;
this.name = name;
this.pin = pin;
this.registrationLock = registrationLock;
this.payments = payments;
this.discoverableByPhoneNumber = discoverableByPhoneNumber; this.discoverableByPhoneNumber = discoverableByPhoneNumber;
this.capabilities = capabilities; this.capabilities = capabilities;
} }
public boolean getFetchesMessages() { public boolean getFetchesMessages() {
@ -95,10 +84,6 @@ public class AccountAttributes {
return capabilities; return capabilities;
} }
public List<PaymentAddress> getPayments() {
return payments;
}
public boolean isDiscoverableByPhoneNumber() { public boolean isDiscoverableByPhoneNumber() {
return discoverableByPhoneNumber; return discoverableByPhoneNumber;
} }

View File

@ -9,10 +9,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse; import org.signal.zkgroup.profiles.ProfileKeyCredentialResponse;
import org.whispersystems.textsecuregcm.storage.PaymentAddress;
public class Profile { public class Profile {
@ -49,9 +47,6 @@ public class Profile {
@JsonProperty @JsonProperty
private UUID uuid; private UUID uuid;
@JsonProperty
private List<PaymentAddress> payments;
@JsonProperty @JsonProperty
@JsonSerialize(using = ProfileKeyCredentialResponseAdapter.Serializing.class) @JsonSerialize(using = ProfileKeyCredentialResponseAdapter.Serializing.class)
@JsonDeserialize(using = ProfileKeyCredentialResponseAdapter.Deserializing.class) @JsonDeserialize(using = ProfileKeyCredentialResponseAdapter.Deserializing.class)
@ -62,7 +57,7 @@ public class Profile {
public Profile( public Profile(
String name, String about, String aboutEmoji, String avatar, String paymentAddress, String identityKey, String name, String about, String aboutEmoji, String avatar, String paymentAddress, String identityKey,
String unidentifiedAccess, boolean unrestrictedUnidentifiedAccess, UserCapabilities capabilities, String username, String unidentifiedAccess, boolean unrestrictedUnidentifiedAccess, UserCapabilities capabilities, String username,
UUID uuid, ProfileKeyCredentialResponse credential, List<PaymentAddress> payments) UUID uuid, ProfileKeyCredentialResponse credential)
{ {
this.name = name; this.name = name;
this.about = about; this.about = about;
@ -75,7 +70,6 @@ public class Profile {
this.capabilities = capabilities; this.capabilities = capabilities;
this.username = username; this.username = username;
this.uuid = uuid; this.uuid = uuid;
this.payments = payments;
this.credential = credential; this.credential = credential;
} }
@ -130,9 +124,4 @@ public class Profile {
public UUID getUuid() { public UUID getUuid() {
return uuid; return uuid;
} }
@VisibleForTesting
public List<PaymentAddress> getPayments() {
return payments;
}
} }

View File

@ -8,16 +8,14 @@ package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.whispersystems.textsecuregcm.auth.AmbiguousIdentifier;
import org.whispersystems.textsecuregcm.auth.StoredRegistrationLock;
import javax.security.auth.Subject;
import java.security.Principal; import java.security.Principal;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import javax.security.auth.Subject;
import org.whispersystems.textsecuregcm.auth.AmbiguousIdentifier;
import org.whispersystems.textsecuregcm.auth.StoredRegistrationLock;
public class Account implements Principal { public class Account implements Principal {
@ -42,9 +40,6 @@ public class Account implements Principal {
@JsonProperty @JsonProperty
private String pin; private String pin;
@JsonProperty
private List<PaymentAddress> payments;
@JsonProperty @JsonProperty
private String registrationLock; private String registrationLock;
@ -245,14 +240,6 @@ public class Account implements Principal {
this.unrestrictedUnidentifiedAccess = unrestrictedUnidentifiedAccess; this.unrestrictedUnidentifiedAccess = unrestrictedUnidentifiedAccess;
} }
public List<PaymentAddress> getPayments() {
return payments;
}
public void setPayments(List<PaymentAddress> payments) {
this.payments = payments;
}
public boolean isFor(AmbiguousIdentifier identifier) { public boolean isFor(AmbiguousIdentifier identifier) {
if (identifier.hasUuid()) return identifier.getUuid().equals(uuid); if (identifier.hasUuid()) return identifier.getUuid().equals(uuid);
else if (identifier.hasNumber()) return identifier.getNumber().equals(number); else if (identifier.hasNumber()) return identifier.getNumber().equals(number);

View File

@ -1,56 +0,0 @@
/*
* Copyright 2013-2020 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.RegEx;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Objects;
public class PaymentAddress {
@JsonProperty
@NotEmpty
@Size(max = 256)
private String address;
@JsonProperty
@NotEmpty
@Size(min = 88, max = 88)
private String signature;
public PaymentAddress() {}
public PaymentAddress(String address, String signature) {
this.address = address;
this.signature = signature;
}
public String getSignature() {
return signature;
}
public String getAddress() {
return address;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaymentAddress that = (PaymentAddress) o;
return Objects.equals(address, that.address) && Objects.equals(signature, that.signature);
}
@Override
public int hashCode() {
return Objects.hash(address, signature);
}
}

View File

@ -1,32 +0,0 @@
/*
* Copyright 2013-2020 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
public class PaymentAddressList {
@JsonProperty
@NotNull
@Valid
private List<PaymentAddress> payments;
public PaymentAddressList() {
}
public PaymentAddressList(List<PaymentAddress> payments) {
this.payments = payments;
}
public List<PaymentAddress> getPayments() {
return payments;
}
}

View File

@ -27,7 +27,6 @@ import java.io.IOException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -73,8 +72,6 @@ import org.whispersystems.textsecuregcm.storage.AbusiveHostRules;
import org.whispersystems.textsecuregcm.storage.Account; import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.MessagesManager; import org.whispersystems.textsecuregcm.storage.MessagesManager;
import org.whispersystems.textsecuregcm.storage.PaymentAddress;
import org.whispersystems.textsecuregcm.storage.PaymentAddressList;
import org.whispersystems.textsecuregcm.storage.PendingAccountsManager; import org.whispersystems.textsecuregcm.storage.PendingAccountsManager;
import org.whispersystems.textsecuregcm.storage.UsernamesManager; import org.whispersystems.textsecuregcm.storage.UsernamesManager;
import org.whispersystems.textsecuregcm.tests.util.AuthHelper; import org.whispersystems.textsecuregcm.tests.util.AuthHelper;
@ -547,7 +544,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "1234")) .target(String.format("/v1/accounts/code/%s", "1234"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -568,7 +565,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "1234")) .target(String.format("/v1/accounts/code/%s", "1234"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, null, false, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, false, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -589,7 +586,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_HAS_STORAGE, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_HAS_STORAGE, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -606,7 +603,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "1234")) .target(String.format("/v1/accounts/code/%s", "1234"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_OLD, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_OLD, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(403); assertThat(response.getStatus()).isEqualTo(403);
@ -621,7 +618,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "1111")) .target(String.format("/v1/accounts/code/%s", "1111"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(403); assertThat(response.getStatus()).isEqualTo(403);
@ -636,7 +633,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "333333")) .target(String.format("/v1/accounts/code/%s", "333333"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, "31337"), .put(Entity.entity(new AccountAttributes(false, 3333, null, "31337", null, true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -651,7 +648,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null, null, Hex.toStringCondensed(registration_lock_key), null, true, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, Hex.toStringCondensed(registration_lock_key), true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -667,7 +664,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null, null, Hex.toStringCondensed(registration_lock_key), null, true, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, Hex.toStringCondensed(registration_lock_key), true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -701,7 +698,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, null, true, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -719,7 +716,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "333333")) .target(String.format("/v1/accounts/code/%s", "333333"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, "31338"), .put(Entity.entity(new AccountAttributes(false, 3333, null, "31338", null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(423); assertThat(response.getStatus()).isEqualTo(423);
@ -734,7 +731,8 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, Hex.toStringCondensed(new byte[32])), .put(Entity.entity(new AccountAttributes(false, 3333, null,
Hex.toStringCondensed(new byte[32]), null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(423); assertThat(response.getStatus()).isEqualTo(423);
@ -749,7 +747,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "333333")) .target(String.format("/v1/accounts/code/%s", "333333"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_PIN, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(423); assertThat(response.getStatus()).isEqualTo(423);
@ -767,7 +765,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "666666")) .target(String.format("/v1/accounts/code/%s", "666666"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_REG_LOCK, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(423); assertThat(response.getStatus()).isEqualTo(423);
@ -790,7 +788,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "444444")) .target(String.format("/v1/accounts/code/%s", "444444"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_OVER_PIN, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_OVER_PIN, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, "31337"), .put(Entity.entity(new AccountAttributes(false, 3333, null, "31337", null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(413); assertThat(response.getStatus()).isEqualTo(413);
@ -808,7 +806,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "444444")) .target(String.format("/v1/accounts/code/%s", "444444"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_OVER_PIN, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_OVER_PIN, "bar"))
.put(Entity.entity(new AccountAttributes(false, 3333, null), .put(Entity.entity(new AccountAttributes(false, 3333, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class); MediaType.APPLICATION_JSON_TYPE), AccountCreationResult.class);
assertThat(result.getUuid()).isNotNull(); assertThat(result.getUuid()).isNotNull();
@ -828,7 +826,7 @@ public class AccountControllerTest {
.queryParam("transfer", true) .queryParam("transfer", true)
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(409); assertThat(response.getStatus()).isEqualTo(409);
@ -844,7 +842,7 @@ public class AccountControllerTest {
.queryParam("transfer", true) .queryParam("transfer", true)
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
@ -859,7 +857,7 @@ public class AccountControllerTest {
.target(String.format("/v1/accounts/code/%s", "1234")) .target(String.format("/v1/accounts/code/%s", "1234"))
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar")) .header("Authorization", AuthHelper.getAuthHeader(SENDER_TRANSFER, "bar"))
.put(Entity.entity(new AccountAttributes(false, 2222, null), .put(Entity.entity(new AccountAttributes(false, 2222, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(200); assertThat(response.getStatus()).isEqualTo(200);
@ -903,79 +901,6 @@ public class AccountControllerTest {
assertThat(pinCapture.getValue().length()).isEqualTo(40); assertThat(pinCapture.getValue().length()).isEqualTo(40);
} }
@Test
public void testSetPayments() {
PaymentAddress paymentAddress = new PaymentAddress("some address", "V15Pf5JsFcQF6AtlM3vo3OhGEgFwTh8G3iDDvShpr8QzoJmFQ+a2xb3PoXRmGF60DLq1RR2o8Fgw+f953mKvNA==");
Response response =
resources.getJerseyTest()
.target("/v1/accounts/payments/")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID.toString(), AuthHelper.VALID_PASSWORD))
.put(Entity.json(new PaymentAddressList(List.of(paymentAddress))));
assertThat(response.getStatus()).isEqualTo(204);
verify(AuthHelper.VALID_ACCOUNT, times(1)).setPayments(eq(List.of(paymentAddress)));
}
@Test
public void testSetPaymentsUnauthorized() {
PaymentAddress paymentAddress = new PaymentAddress("an address", "V15Pf5JsFcQF6AtlM3vo3OhGEgFwTh8G3iDDvShpr8QzoJmFQ+a2xb3PoXRmGF60DLq1RR2o8Fgw+f953mKvNA==");
Response response =
resources.getJerseyTest()
.target("/v1/accounts/payments/")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.INVALID_UUID.toString(), AuthHelper.INVALID_PASSWORD))
.put(Entity.json(new PaymentAddressList(List.of(paymentAddress))));
assertThat(response.getStatus()).isEqualTo(401);
}
@Test
public void testSetPaymentsInvalidSignature() {
PaymentAddress paymentAddress = new PaymentAddress("some address", "123456789012345678901234567890123");
Response response =
resources.getJerseyTest()
.target("/v1/accounts/payments/")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID.toString(), AuthHelper.VALID_PASSWORD))
.put(Entity.json(new PaymentAddressList(List.of(paymentAddress))));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testSetPaymentsEmptyAddress() {
PaymentAddress paymentAddress = new PaymentAddress(null, "V15Pf5JsFcQF6AtlM3vo3OhGEgFwTh8G3iDDvShpr8QzoJmFQ+a2xb3PoXRmGF60DLq1RR2o8Fgw+f953mKvNA==");
Response response =
resources.getJerseyTest()
.target("/v1/accounts/payments/")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID.toString(), AuthHelper.VALID_PASSWORD))
.put(Entity.json(new PaymentAddressList(List.of(paymentAddress))));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test
public void testSetPaymentsEmptySignature() {
PaymentAddress paymentAddress = new PaymentAddress("some address", null);
Response response =
resources.getJerseyTest()
.target("/v1/accounts/payments/")
.request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID.toString(), AuthHelper.VALID_PASSWORD))
.put(Entity.json(new PaymentAddressList(List.of(paymentAddress))));
assertThat(response.getStatus()).isEqualTo(422);
}
@Test @Test
public void testSetPinUnauthorized() throws Exception { public void testSetPinUnauthorized() throws Exception {
Response response = Response response =
@ -1207,7 +1132,7 @@ public class AccountControllerTest {
.target("/v1/accounts/attributes/") .target("/v1/accounts/attributes/")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, AuthHelper.VALID_PASSWORD)) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, AuthHelper.VALID_PASSWORD))
.put(Entity.json(new AccountAttributes(false, 2222, null, null, null, null, true, null))); .put(Entity.json(new AccountAttributes(false, 2222, null, null, null, true, null)));
assertThat(response.getStatus()).isEqualTo(204); assertThat(response.getStatus()).isEqualTo(204);
verify(directoryQueue, never()).refreshRegisteredUser(any()); verify(directoryQueue, never()).refreshRegisteredUser(any());
@ -1220,7 +1145,7 @@ public class AccountControllerTest {
.target("/v1/accounts/attributes/") .target("/v1/accounts/attributes/")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.UNDISCOVERABLE_NUMBER, AuthHelper.UNDISCOVERABLE_PASSWORD)) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.UNDISCOVERABLE_NUMBER, AuthHelper.UNDISCOVERABLE_PASSWORD))
.put(Entity.json(new AccountAttributes(false, 2222, null, null, null, null, true, null))); .put(Entity.json(new AccountAttributes(false, 2222, null, null, null, true, null)));
assertThat(response.getStatus()).isEqualTo(204); assertThat(response.getStatus()).isEqualTo(204);
verify(directoryQueue, times(1)).refreshRegisteredUser(AuthHelper.UNDISCOVERABLE_ACCOUNT); verify(directoryQueue, times(1)).refreshRegisteredUser(AuthHelper.UNDISCOVERABLE_ACCOUNT);
@ -1233,7 +1158,7 @@ public class AccountControllerTest {
.target("/v1/accounts/attributes/") .target("/v1/accounts/attributes/")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, AuthHelper.VALID_PASSWORD)) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, AuthHelper.VALID_PASSWORD))
.put(Entity.json(new AccountAttributes(false, 2222, null, null, null, null, false, null))); .put(Entity.json(new AccountAttributes(false, 2222, null, null, null, false, null)));
assertThat(response.getStatus()).isEqualTo(204); assertThat(response.getStatus()).isEqualTo(204);
verify(directoryQueue, times(1)).refreshRegisteredUser(AuthHelper.VALID_ACCOUNT); verify(directoryQueue, times(1)).refreshRegisteredUser(AuthHelper.VALID_ACCOUNT);

View File

@ -135,7 +135,8 @@ public class DeviceControllerTest {
.target("/v1/devices/5678901") .target("/v1/devices/5678901")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1")) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
.put(Entity.entity(new AccountAttributes(false, 1234, null), .put(Entity.entity(new AccountAttributes(false, 1234, null,
null, null, true, null),
MediaType.APPLICATION_JSON_TYPE), MediaType.APPLICATION_JSON_TYPE),
DeviceResponse.class); DeviceResponse.class);
@ -170,7 +171,7 @@ public class DeviceControllerTest {
.target("/v1/devices/5678902") .target("/v1/devices/5678902")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1")) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
.put(Entity.entity(new AccountAttributes(false, 1234, null), .put(Entity.entity(new AccountAttributes(false, 1234, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(403); assertThat(response.getStatus()).isEqualTo(403);
@ -184,7 +185,7 @@ public class DeviceControllerTest {
.target("/v1/devices/1112223") .target("/v1/devices/1112223")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER_TWO, AuthHelper.VALID_PASSWORD_TWO)) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER_TWO, AuthHelper.VALID_PASSWORD_TWO))
.put(Entity.entity(new AccountAttributes(false, 1234, null), .put(Entity.entity(new AccountAttributes(false, 1234, null, null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatus()).isEqualTo(403); assertThat(response.getStatus()).isEqualTo(403);
@ -210,7 +211,7 @@ public class DeviceControllerTest {
.target("/v1/devices/5678901") .target("/v1/devices/5678901")
.request() .request()
.header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1")) .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_NUMBER, "password1"))
.put(Entity.entity(new AccountAttributes(false, 1234, "this is a really long name that is longer than 80 characters it's so long that it's even longer than 204 characters. that's a lot of characters. we're talking lots and lots and lots of characters. 12345678", null, null, null, true, null), .put(Entity.entity(new AccountAttributes(false, 1234, "this is a really long name that is longer than 80 characters it's so long that it's even longer than 204 characters. that's a lot of characters. we're talking lots and lots and lots of characters. 12345678", null, null, true, null),
MediaType.APPLICATION_JSON_TYPE)); MediaType.APPLICATION_JSON_TYPE));
assertEquals(response.getStatus(), 422); assertEquals(response.getStatus(), 422);
@ -221,7 +222,7 @@ public class DeviceControllerTest {
@Parameters(method = "argumentsForDeviceDowngradeCapabilitiesTest") @Parameters(method = "argumentsForDeviceDowngradeCapabilitiesTest")
public void deviceDowngradeCapabilitiesTest(final String userAgent, final boolean gv2, final boolean gv2_2, final boolean gv2_3, final int expectedStatus) throws Exception { public void deviceDowngradeCapabilitiesTest(final String userAgent, final boolean gv2, final boolean gv2_2, final boolean gv2_3, final int expectedStatus) throws Exception {
Device.DeviceCapabilities deviceCapabilities = new Device.DeviceCapabilities(gv2, gv2_2, gv2_3, true, false, true); Device.DeviceCapabilities deviceCapabilities = new Device.DeviceCapabilities(gv2, gv2_2, gv2_3, true, false, true);
AccountAttributes accountAttributes = new AccountAttributes(false, 1234, null, null, null, null, true, deviceCapabilities); AccountAttributes accountAttributes = new AccountAttributes(false, 1234, null, null, null, true, deviceCapabilities);
Response response = resources.getJerseyTest() Response response = resources.getJerseyTest()
.target("/v1/devices/5678901") .target("/v1/devices/5678901")
.request() .request()
@ -261,7 +262,7 @@ public class DeviceControllerTest {
@Test @Test
public void deviceDowngradeGv1MigrationTest() { public void deviceDowngradeGv1MigrationTest() {
Device.DeviceCapabilities deviceCapabilities = new Device.DeviceCapabilities(true, true, true, true, false, false); Device.DeviceCapabilities deviceCapabilities = new Device.DeviceCapabilities(true, true, true, true, false, false);
AccountAttributes accountAttributes = new AccountAttributes(false, 1234, null, null, null, null, true, deviceCapabilities); AccountAttributes accountAttributes = new AccountAttributes(false, 1234, null, null, null, true, deviceCapabilities);
Response response = resources.getJerseyTest() Response response = resources.getJerseyTest()
.target("/v1/devices/5678901") .target("/v1/devices/5678901")
.request() .request()
@ -272,7 +273,7 @@ public class DeviceControllerTest {
assertThat(response.getStatus()).isEqualTo(409); assertThat(response.getStatus()).isEqualTo(409);
deviceCapabilities = new Device.DeviceCapabilities(true, true, true, true, false, true); deviceCapabilities = new Device.DeviceCapabilities(true, true, true, true, false, true);
accountAttributes = new AccountAttributes(false, 1234, null, null, null, null, true, deviceCapabilities); accountAttributes = new AccountAttributes(false, 1234, null, null, null, true, deviceCapabilities);
response = resources.getJerseyTest() response = resources.getJerseyTest()
.target("/v1/devices/5678901") .target("/v1/devices/5678901")
.request() .request()

View File

@ -21,7 +21,6 @@ import com.amazonaws.services.s3.AmazonS3;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider; import io.dropwizard.auth.PolymorphicAuthValueFactoryProvider;
import io.dropwizard.testing.junit.ResourceTestRule; import io.dropwizard.testing.junit.ResourceTestRule;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import javax.ws.rs.client.Entity; import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
@ -50,7 +49,6 @@ import org.whispersystems.textsecuregcm.s3.PolicySigner;
import org.whispersystems.textsecuregcm.s3.PostPolicyGenerator; import org.whispersystems.textsecuregcm.s3.PostPolicyGenerator;
import org.whispersystems.textsecuregcm.storage.Account; import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager; import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.PaymentAddress;
import org.whispersystems.textsecuregcm.storage.ProfilesManager; import org.whispersystems.textsecuregcm.storage.ProfilesManager;
import org.whispersystems.textsecuregcm.storage.UsernamesManager; import org.whispersystems.textsecuregcm.storage.UsernamesManager;
import org.whispersystems.textsecuregcm.storage.VersionedProfile; import org.whispersystems.textsecuregcm.storage.VersionedProfile;
@ -106,7 +104,6 @@ public class ProfileControllerTest {
when(profileAccount.isEnabled()).thenReturn(true); when(profileAccount.isEnabled()).thenReturn(true);
when(profileAccount.isGroupsV2Supported()).thenReturn(false); when(profileAccount.isGroupsV2Supported()).thenReturn(false);
when(profileAccount.isGv1MigrationSupported()).thenReturn(false); when(profileAccount.isGv1MigrationSupported()).thenReturn(false);
when(profileAccount.getPayments()).thenReturn(List.of(new PaymentAddress("mc", "12345678901234567890123456789012")));
Account capabilitiesAccount = mock(Account.class); Account capabilitiesAccount = mock(Account.class);
@ -150,7 +147,6 @@ public class ProfileControllerTest {
assertThat(profile.getName()).isEqualTo("baz"); assertThat(profile.getName()).isEqualTo("baz");
assertThat(profile.getAvatar()).isEqualTo("profiles/bang"); assertThat(profile.getAvatar()).isEqualTo("profiles/bang");
assertThat(profile.getUsername()).isEqualTo("n00bkiller"); assertThat(profile.getUsername()).isEqualTo("n00bkiller");
assertThat(profile.getPayments()).isEqualTo(List.of(new PaymentAddress("mc", "12345678901234567890123456789012")));
verify(accountsManager, times(1)).get(argThat((ArgumentMatcher<AmbiguousIdentifier>) identifier -> identifier != null && identifier.hasUuid() && identifier.getUuid().equals(AuthHelper.VALID_UUID_TWO))); verify(accountsManager, times(1)).get(argThat((ArgumentMatcher<AmbiguousIdentifier>) identifier -> identifier != null && identifier.hasUuid() && identifier.getUuid().equals(AuthHelper.VALID_UUID_TWO)));
verify(usernamesManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO)); verify(usernamesManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO));
@ -168,11 +164,10 @@ public class ProfileControllerTest {
assertThat(profile.getIdentityKey()).isEqualTo("bar"); assertThat(profile.getIdentityKey()).isEqualTo("bar");
assertThat(profile.getName()).isEqualTo("baz"); assertThat(profile.getName()).isEqualTo("baz");
assertThat(profile.getAvatar()).isEqualTo("profiles/bang"); assertThat(profile.getAvatar()).isEqualTo("profiles/bang");
assertThat(profile.getPayments()).isEqualTo(List.of(new PaymentAddress("mc", "12345678901234567890123456789012")));
assertThat(profile.getCapabilities().isGv2()).isFalse(); assertThat(profile.getCapabilities().isGv2()).isFalse();
assertThat(profile.getCapabilities().isGv1Migration()).isFalse(); assertThat(profile.getCapabilities().isGv1Migration()).isFalse();
assertThat(profile.getUsername()).isNull(); assertThat(profile.getUsername()).isNull();
assertThat(profile.getUuid()).isNull();; assertThat(profile.getUuid()).isNull();
verify(accountsManager, times(1)).get(argThat((ArgumentMatcher<AmbiguousIdentifier>) identifier -> identifier != null && identifier.hasNumber() && identifier.getNumber().equals(AuthHelper.VALID_NUMBER_TWO))); verify(accountsManager, times(1)).get(argThat((ArgumentMatcher<AmbiguousIdentifier>) identifier -> identifier != null && identifier.hasNumber() && identifier.getNumber().equals(AuthHelper.VALID_NUMBER_TWO)));
verifyNoMoreInteractions(usernamesManager); verifyNoMoreInteractions(usernamesManager);
@ -191,7 +186,6 @@ public class ProfileControllerTest {
assertThat(profile.getName()).isEqualTo("baz"); assertThat(profile.getName()).isEqualTo("baz");
assertThat(profile.getAvatar()).isEqualTo("profiles/bang"); assertThat(profile.getAvatar()).isEqualTo("profiles/bang");
assertThat(profile.getUsername()).isEqualTo("n00bkiller"); assertThat(profile.getUsername()).isEqualTo("n00bkiller");
assertThat(profile.getPayments()).isEqualTo(List.of(new PaymentAddress("mc", "12345678901234567890123456789012")));
assertThat(profile.getUuid()).isEqualTo(AuthHelper.VALID_UUID_TWO); assertThat(profile.getUuid()).isEqualTo(AuthHelper.VALID_UUID_TWO);
verify(accountsManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO)); verify(accountsManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO));
@ -513,7 +507,7 @@ public class ProfileControllerTest {
assertThat(profile.getCapabilities().isGv2()).isFalse(); assertThat(profile.getCapabilities().isGv2()).isFalse();
assertThat(profile.getCapabilities().isGv1Migration()).isFalse(); assertThat(profile.getCapabilities().isGv1Migration()).isFalse();
assertThat(profile.getUsername()).isEqualTo("n00bkiller"); assertThat(profile.getUsername()).isEqualTo("n00bkiller");
assertThat(profile.getUuid()).isNull();; assertThat(profile.getUuid()).isNull();
verify(accountsManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO)); verify(accountsManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO));
verify(usernamesManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO)); verify(usernamesManager, times(1)).get(eq(AuthHelper.VALID_UUID_TWO));