Don't allow secondary devices to resurrect inactive device status
This commit is contained in:
parent
e5a89946f6
commit
fa0745e226
|
@ -66,6 +66,10 @@ public class AccountAuthenticator implements Authenticator<BasicCredentials, Acc
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!device.get().isMaster() && !device.get().isActive()) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
if (device.get().getAuthenticationCredentials().verify(basicCredentials.getPassword())) {
|
if (device.get().getAuthenticationCredentials().verify(basicCredentials.getPassword())) {
|
||||||
authenticationSucceededMeter.mark();
|
authenticationSucceededMeter.mark();
|
||||||
account.get().setAuthenticatedDevice(device.get());
|
account.get().setAuthenticatedDevice(device.get());
|
||||||
|
|
|
@ -41,9 +41,11 @@ public class AuthHelper {
|
||||||
when(VALID_CREDENTIALS_TWO.verify("baz")).thenReturn(true);
|
when(VALID_CREDENTIALS_TWO.verify("baz")).thenReturn(true);
|
||||||
when(VALID_DEVICE.getAuthenticationCredentials()).thenReturn(VALID_CREDENTIALS);
|
when(VALID_DEVICE.getAuthenticationCredentials()).thenReturn(VALID_CREDENTIALS);
|
||||||
when(VALID_DEVICE_TWO.getAuthenticationCredentials()).thenReturn(VALID_CREDENTIALS_TWO);
|
when(VALID_DEVICE_TWO.getAuthenticationCredentials()).thenReturn(VALID_CREDENTIALS_TWO);
|
||||||
|
when(VALID_DEVICE.isMaster()).thenReturn(true);
|
||||||
|
when(VALID_DEVICE_TWO.isMaster()).thenReturn(true);
|
||||||
when(VALID_DEVICE.getId()).thenReturn(1L);
|
when(VALID_DEVICE.getId()).thenReturn(1L);
|
||||||
when(VALID_DEVICE_TWO.getId()).thenReturn(1L);
|
when(VALID_DEVICE_TWO.getId()).thenReturn(1L);
|
||||||
when(VALID_ACCOUNT.getDevice(anyLong())).thenReturn(Optional.of(VALID_DEVICE));
|
when(VALID_ACCOUNT.getDevice(1L)).thenReturn(Optional.of(VALID_DEVICE));
|
||||||
when(VALID_ACCOUNT_TWO.getDevice(eq(1L))).thenReturn(Optional.of(VALID_DEVICE_TWO));
|
when(VALID_ACCOUNT_TWO.getDevice(eq(1L))).thenReturn(Optional.of(VALID_DEVICE_TWO));
|
||||||
when(VALID_ACCOUNT_TWO.getActiveDeviceCount()).thenReturn(6);
|
when(VALID_ACCOUNT_TWO.getActiveDeviceCount()).thenReturn(6);
|
||||||
when(VALID_ACCOUNT.getNumber()).thenReturn(VALID_NUMBER);
|
when(VALID_ACCOUNT.getNumber()).thenReturn(VALID_NUMBER);
|
||||||
|
|
Loading…
Reference in New Issue