mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 12:07:59 +01:00
Rename AuthenticatedAccount to AuthenticatedDevice
This commit is contained in:
committed by
Jon Chambers
parent
1ea9e38fea
commit
0075e94a42
@@ -24,7 +24,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.whispersystems.textsecuregcm.auth.AccountAuthenticator;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
|
||||
import org.whispersystems.textsecuregcm.storage.Account;
|
||||
import org.whispersystems.textsecuregcm.storage.Device;
|
||||
import org.whispersystems.textsecuregcm.util.HeaderUtils;
|
||||
@@ -52,7 +52,7 @@ class WebSocketAccountAuthenticatorTest {
|
||||
accountAuthenticator = mock(AccountAuthenticator.class);
|
||||
|
||||
when(accountAuthenticator.authenticate(eq(new BasicCredentials(VALID_USER, VALID_PASSWORD))))
|
||||
.thenReturn(Optional.of(new AuthenticatedAccount(mock(Account.class), mock(Device.class))));
|
||||
.thenReturn(Optional.of(new AuthenticatedDevice(mock(Account.class), mock(Device.class))));
|
||||
|
||||
when(accountAuthenticator.authenticate(eq(new BasicCredentials(INVALID_USER, INVALID_PASSWORD))))
|
||||
.thenReturn(Optional.empty());
|
||||
@@ -77,7 +77,7 @@ class WebSocketAccountAuthenticatorTest {
|
||||
accountAuthenticator,
|
||||
mock(PrincipalSupplier.class));
|
||||
|
||||
final ReusableAuth<AuthenticatedAccount> result = webSocketAuthenticator.authenticate(upgradeRequest);
|
||||
final ReusableAuth<AuthenticatedDevice> result = webSocketAuthenticator.authenticate(upgradeRequest);
|
||||
|
||||
assertEquals(expectAccount, result.ref().isPresent());
|
||||
assertEquals(expectInvalid, result.invalidCredentialsProvided());
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
||||
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
||||
@@ -127,7 +127,7 @@ class WebSocketConnectionIntegrationTest {
|
||||
new MessagesManager(messagesDynamoDb, messagesCache, reportMessageManager, sharedExecutorService),
|
||||
new MessageMetrics(),
|
||||
mock(PushNotificationManager.class),
|
||||
new AuthenticatedAccount(account, device),
|
||||
new AuthenticatedDevice(account, device),
|
||||
webSocketClient,
|
||||
scheduledExecutorService,
|
||||
messageDeliveryScheduler,
|
||||
@@ -213,7 +213,7 @@ class WebSocketConnectionIntegrationTest {
|
||||
new MessagesManager(messagesDynamoDb, messagesCache, reportMessageManager, sharedExecutorService),
|
||||
new MessageMetrics(),
|
||||
mock(PushNotificationManager.class),
|
||||
new AuthenticatedAccount(account, device),
|
||||
new AuthenticatedDevice(account, device),
|
||||
webSocketClient,
|
||||
scheduledExecutorService,
|
||||
messageDeliveryScheduler,
|
||||
@@ -280,7 +280,7 @@ class WebSocketConnectionIntegrationTest {
|
||||
new MessagesManager(messagesDynamoDb, messagesCache, reportMessageManager, sharedExecutorService),
|
||||
new MessageMetrics(),
|
||||
mock(PushNotificationManager.class),
|
||||
new AuthenticatedAccount(account, device),
|
||||
new AuthenticatedDevice(account, device),
|
||||
webSocketClient,
|
||||
100, // use a very short timeout, so that this test completes quickly
|
||||
scheduledExecutorService,
|
||||
|
||||
@@ -10,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.ArgumentMatchers.anyByte;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
@@ -55,7 +54,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.whispersystems.textsecuregcm.auth.AccountAuthenticator;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedAccount;
|
||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
|
||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
||||
import org.whispersystems.textsecuregcm.push.ClientPresenceManager;
|
||||
@@ -89,7 +88,7 @@ class WebSocketConnectionTest {
|
||||
private AccountsManager accountsManager;
|
||||
private Account account;
|
||||
private Device device;
|
||||
private AuthenticatedAccount auth;
|
||||
private AuthenticatedDevice auth;
|
||||
private UpgradeRequest upgradeRequest;
|
||||
private MessagesManager messagesManager;
|
||||
private ReceiptSender receiptSender;
|
||||
@@ -103,7 +102,7 @@ class WebSocketConnectionTest {
|
||||
accountsManager = mock(AccountsManager.class);
|
||||
account = mock(Account.class);
|
||||
device = mock(Device.class);
|
||||
auth = new AuthenticatedAccount(account, device);
|
||||
auth = new AuthenticatedDevice(account, device);
|
||||
upgradeRequest = mock(UpgradeRequest.class);
|
||||
messagesManager = mock(MessagesManager.class);
|
||||
receiptSender = mock(ReceiptSender.class);
|
||||
@@ -128,11 +127,11 @@ class WebSocketConnectionTest {
|
||||
WebSocketSessionContext sessionContext = mock(WebSocketSessionContext.class);
|
||||
|
||||
when(accountAuthenticator.authenticate(eq(new BasicCredentials(VALID_USER, VALID_PASSWORD))))
|
||||
.thenReturn(Optional.of(new AuthenticatedAccount(account, device)));
|
||||
.thenReturn(Optional.of(new AuthenticatedDevice(account, device)));
|
||||
|
||||
ReusableAuth<AuthenticatedAccount> account = webSocketAuthenticator.authenticate(upgradeRequest);
|
||||
ReusableAuth<AuthenticatedDevice> account = webSocketAuthenticator.authenticate(upgradeRequest);
|
||||
when(sessionContext.getAuthenticated()).thenReturn(account.ref().orElse(null));
|
||||
when(sessionContext.getAuthenticated(AuthenticatedAccount.class)).thenReturn(account.ref().orElse(null));
|
||||
when(sessionContext.getAuthenticated(AuthenticatedDevice.class)).thenReturn(account.ref().orElse(null));
|
||||
|
||||
final WebSocketClient webSocketClient = mock(WebSocketClient.class);
|
||||
when(webSocketClient.getUserAgent()).thenReturn("Signal-Android/6.22.8");
|
||||
|
||||
Reference in New Issue
Block a user