Gather data to verify safety of retiring legacy reglock system.
This commit is contained in:
parent
9faeed7b20
commit
e3afcae7d3
|
@ -527,7 +527,10 @@ public class AccountController {
|
||||||
@PUT
|
@PUT
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/pin/")
|
@Path("/pin/")
|
||||||
public void setPin(@Auth Account account, @Valid DeprecatedPin accountLock) {
|
public void setPin(@Auth Account account, @Valid DeprecatedPin accountLock, @HeaderParam("User-Agent") String userAgent) {
|
||||||
|
// TODO Remove once PIN-based reglocks have been deprecated
|
||||||
|
logger.info("PIN set by User-Agent: {}", userAgent);
|
||||||
|
|
||||||
account.setPin(accountLock.getPin());
|
account.setPin(accountLock.getPin());
|
||||||
account.setRegistrationLock(null, null);
|
account.setRegistrationLock(null, null);
|
||||||
|
|
||||||
|
@ -537,7 +540,10 @@ public class AccountController {
|
||||||
@Timed
|
@Timed
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/pin/")
|
@Path("/pin/")
|
||||||
public void removePin(@Auth Account account) {
|
public void removePin(@Auth Account account, @HeaderParam("User-Agent") String userAgent) {
|
||||||
|
// TODO Remove once PIN-based reglocks have been deprecated
|
||||||
|
logger.info("PIN removed by User-Agent: {}", userAgent);
|
||||||
|
|
||||||
account.setPin(null);
|
account.setPin(null);
|
||||||
accounts.update(account);
|
accounts.update(account);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.whispersystems.textsecuregcm.auth.AmbiguousIdentifier;
|
||||||
import org.whispersystems.textsecuregcm.auth.Anonymous;
|
import org.whispersystems.textsecuregcm.auth.Anonymous;
|
||||||
import org.whispersystems.textsecuregcm.auth.CombinedUnidentifiedSenderAccessKeys;
|
import org.whispersystems.textsecuregcm.auth.CombinedUnidentifiedSenderAccessKeys;
|
||||||
import org.whispersystems.textsecuregcm.auth.OptionalAccess;
|
import org.whispersystems.textsecuregcm.auth.OptionalAccess;
|
||||||
|
import org.whispersystems.textsecuregcm.auth.StoredRegistrationLock;
|
||||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicMessageRateConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicMessageRateConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.entities.AccountMismatchedDevices;
|
import org.whispersystems.textsecuregcm.entities.AccountMismatchedDevices;
|
||||||
import org.whispersystems.textsecuregcm.entities.AccountStaleDevices;
|
import org.whispersystems.textsecuregcm.entities.AccountStaleDevices;
|
||||||
|
@ -496,6 +497,11 @@ public class MessageController {
|
||||||
public OutgoingMessageEntityList getPendingMessages(@Auth Account account, @HeaderParam("User-Agent") String userAgent) {
|
public OutgoingMessageEntityList getPendingMessages(@Auth Account account, @HeaderParam("User-Agent") String userAgent) {
|
||||||
assert account.getAuthenticatedDevice().isPresent();
|
assert account.getAuthenticatedDevice().isPresent();
|
||||||
|
|
||||||
|
// TODO Remove once PIN-based reglocks have been deprecated
|
||||||
|
if (account.getRegistrationLock().requiresClientRegistrationLock() && account.getRegistrationLock().hasDeprecatedPin()) {
|
||||||
|
logger.info("User-Agent with deprecated PIN-based registration lock: {}", userAgent);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Util.isEmpty(account.getAuthenticatedDevice().get().getApnId())) {
|
if (!Util.isEmpty(account.getAuthenticatedDevice().get().getApnId())) {
|
||||||
RedisOperation.unchecked(() -> apnFallbackManager.cancel(account, account.getAuthenticatedDevice().get()));
|
RedisOperation.unchecked(() -> apnFallbackManager.cancel(account, account.getAuthenticatedDevice().get()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,11 @@ public class AuthenticatedConnectListener implements WebSocketConnectListener {
|
||||||
context.getClient(),
|
context.getClient(),
|
||||||
retrySchedulingExecutor);
|
retrySchedulingExecutor);
|
||||||
|
|
||||||
|
// TODO Remove once PIN-based reglocks have been deprecated
|
||||||
|
if (account.getRegistrationLock().requiresClientRegistrationLock() && account.getRegistrationLock().hasDeprecatedPin()) {
|
||||||
|
log.info("User-Agent with deprecated PIN-based registration lock: {}", context.getClient().getUserAgent());
|
||||||
|
}
|
||||||
|
|
||||||
openWebsocketCounter.inc();
|
openWebsocketCounter.inc();
|
||||||
RedisOperation.unchecked(() -> apnFallbackManager.cancel(account, device));
|
RedisOperation.unchecked(() -> apnFallbackManager.cancel(account, device));
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ import org.mockito.stubbing.Answer;
|
||||||
import org.whispersystems.textsecuregcm.auth.AmbiguousIdentifier;
|
import org.whispersystems.textsecuregcm.auth.AmbiguousIdentifier;
|
||||||
import org.whispersystems.textsecuregcm.auth.DisabledPermittedAccount;
|
import org.whispersystems.textsecuregcm.auth.DisabledPermittedAccount;
|
||||||
import org.whispersystems.textsecuregcm.auth.OptionalAccess;
|
import org.whispersystems.textsecuregcm.auth.OptionalAccess;
|
||||||
|
import org.whispersystems.textsecuregcm.auth.StoredRegistrationLock;
|
||||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicMessageRateConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicMessageRateConfiguration;
|
||||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicRateLimitChallengeConfiguration;
|
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicRateLimitChallengeConfiguration;
|
||||||
|
@ -484,6 +485,7 @@ class MessageControllerTest {
|
||||||
OutgoingMessageEntityList messagesList = new OutgoingMessageEntityList(messages, false);
|
OutgoingMessageEntityList messagesList = new OutgoingMessageEntityList(messages, false);
|
||||||
|
|
||||||
when(messagesManager.getMessagesForDevice(eq(AuthHelper.VALID_UUID), eq(1L), anyString(), anyBoolean())).thenReturn(messagesList);
|
when(messagesManager.getMessagesForDevice(eq(AuthHelper.VALID_UUID), eq(1L), anyString(), anyBoolean())).thenReturn(messagesList);
|
||||||
|
when(AuthHelper.VALID_ACCOUNT.getRegistrationLock()).thenReturn(mock(StoredRegistrationLock.class));
|
||||||
|
|
||||||
OutgoingMessageEntityList response =
|
OutgoingMessageEntityList response =
|
||||||
resources.getJerseyTest().target("/v1/messages/")
|
resources.getJerseyTest().target("/v1/messages/")
|
||||||
|
|
Loading…
Reference in New Issue