use of games.strategy.util.Md5Crypt in project triplea by triplea-game.
the class LobbyLoginValidatorIntegrationTest method testAnonymousLogin.
@Test
public void testAnonymousLogin() {
final Map<String, String> response = new HashMap<>();
response.put(LobbyLoginValidator.ANONYMOUS_LOGIN, Boolean.TRUE.toString());
assertNull(generateChallenge(null).apply(challenge -> response));
// create a user, verify we can't login with a username that already exists
// we should not be able to login now
assertNotNull(generateChallenge(new HashedPassword(md5Crypt("foo"))).apply(challenge -> response));
}
use of games.strategy.util.Md5Crypt in project triplea by triplea-game.
the class LobbyLoginValidatorIntegrationTest method testAnonymousLoginBadName.
@Test
public void testAnonymousLoginBadName() {
final String name = "bitCh" + Util.createUniqueTimeStamp();
try {
new BadWordController().addBadWord("bitCh");
} catch (final Exception ignore) {
// this is probably a duplicate insertion error, we can ignore that as it only means we already added the bad
// word previously
}
assertEquals(LobbyLoginValidator.ErrorMessages.THATS_NOT_A_NICE_NAME, generateChallenge(name, new HashedPassword(md5Crypt("foo"))).apply(challenge -> new HashMap<>(Collections.singletonMap(LobbyLoginValidator.ANONYMOUS_LOGIN, Boolean.TRUE.toString()))));
}
Aggregations