use of keywhiz.auth.User in project keywhiz by square.
the class LdapAuthenticatorTest method ldapAuthenticatorRejectsEmptyPassword.
@Ignore
@Test
public void ldapAuthenticatorRejectsEmptyPassword() throws Exception {
Optional<User> user = ldapAuthenticator.authenticate(new BasicCredentials("sysadmin", ""));
assertThat(user).isEmpty();
}
use of keywhiz.auth.User in project keywhiz by square.
the class CookieRenewingFilterTest method setsAllNewCookieWithValidCookie.
@Test
public void setsAllNewCookieWithValidCookie() throws Exception {
User user = User.named("username");
when(request.getCookies()).thenReturn(ImmutableMap.of(SESSION_COOKIE, cookie));
when(authenticator.authenticate(cookie)).thenReturn(Optional.of(user));
NewCookie newCookie1 = new NewCookie(SESSION_COOKIE, "new session");
when(sessionLoginResource.cookiesForUser(user)).thenReturn(ImmutableList.of(newCookie1));
filter.filter(request, response);
assertThat(getCookieMap(response)).contains(entry(newCookie1.getName(), newCookie1.getValue()));
}
Aggregations