mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-25 11:46:38 +01:00
Protect unknown data too
This commit is contained in:
parent
e437321f8f
commit
cc2128b612
@ -99,7 +99,9 @@ public class ListenerService implements SettingsDependent {
|
||||
}
|
||||
|
||||
// registration not enforced, but registered players needs to be restricted if not logged in
|
||||
return playerCache.getRegistrationStatus(name) == RegistrationStatus.REGISTERED;
|
||||
// if there is no data fall back to safer alternative to prevent any leakage
|
||||
final RegistrationStatus status = playerCache.getRegistrationStatus(name);
|
||||
return status != RegistrationStatus.UNREGISTERED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,7 +117,8 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
final boolean isAuthAvailable = database.isAuthAvailable(name);
|
||||
playerCache.addRegistrationStatus(name, isAuthAvailable ? RegistrationStatus.REGISTERED : RegistrationStatus.UNREGISTERED);
|
||||
RegistrationStatus status = isAuthAvailable ? RegistrationStatus.REGISTERED : RegistrationStatus.UNREGISTERED;
|
||||
playerCache.addRegistrationStatus(name, status);
|
||||
if (isAuthAvailable) {
|
||||
protectInventory(player);
|
||||
|
||||
|
@ -4,6 +4,7 @@ import ch.jalu.injector.testing.BeforeInjecting;
|
||||
import ch.jalu.injector.testing.DelayedInjectionRunner;
|
||||
import ch.jalu.injector.testing.InjectDelayed;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.data.auth.PlayerCache.RegistrationStatus;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -119,6 +120,7 @@ public class ListenerServiceTest {
|
||||
String playerName = "myPlayer1";
|
||||
Player player = mockPlayerWithName(playerName);
|
||||
given(playerCache.isAuthenticated(playerName)).willReturn(false);
|
||||
given(playerCache.getRegistrationStatus(playerName)).willReturn(RegistrationStatus.UNREGISTERED);
|
||||
given(settings.getProperty(RegistrationSettings.FORCE)).willReturn(false);
|
||||
EntityEvent event = mock(EntityEvent.class);
|
||||
given(event.getEntity()).willReturn(player);
|
||||
|
Loading…
Reference in New Issue
Block a user