use of io.dropwizard.auth.basic.BasicCredentials in project keywhiz by square.
the class BcryptAuthenticatorTest method bcryptAuthenticatorRejectsInvalidUsername.
@Test
public void bcryptAuthenticatorRejectsInvalidUsername() throws Exception {
String crazyUsername = "sysadmin)`~!@#$%^&*()+=[]{}\\|;:'\",<>?/\r\n\t";
Optional<User> missingUser = bcryptAuthenticator.authenticate(new BasicCredentials(crazyUsername, "validpass"));
assertThat(missingUser.isPresent()).isFalse();
}
use of io.dropwizard.auth.basic.BasicCredentials in project keywhiz by square.
the class LdapAuthenticatorTest method ldapAuthenticatorRejectsEmptyPassword.
@Test
public void ldapAuthenticatorRejectsEmptyPassword() throws Exception {
Optional<User> user = ldapAuthenticator.authenticate(new BasicCredentials("sysadmin", ""));
assertThat(user.isPresent()).isFalse();
}
use of io.dropwizard.auth.basic.BasicCredentials in project keywhiz by square.
the class LdapAuthenticatorTest method ldapAuthenticatorThrowsWhenAuthFails.
@Test
public void ldapAuthenticatorThrowsWhenAuthFails() throws Exception {
// Zero results on a search indicates no valid user.
when(dnSearchResult.getEntryCount()).thenReturn(0);
Optional<User> missingUser = ldapAuthenticator.authenticate(new BasicCredentials("sysadmin", "badpass"));
assertThat(missingUser.isPresent()).isFalse();
}
Aggregations