}
}
@Test
public void testAuthenticateBeforePasswordExpired() throws Exception {
Authentication a = new UserAuthentication(getUserConfiguration(), root, userId);
// set password last modified to beginning of epoch
root.getTree(getTestUser().getPath()).getChild(UserConstants.REP_PWD).setProperty(UserConstants.REP_PASSWORD_LAST_MODIFIED, 0);
root.commit();
try {
a.authenticate(new SimpleCredentials(userId, "wrong".toCharArray()));
} catch (CredentialExpiredException e) {
fail("Login should fail before expiry");
} catch (LoginException e) {
// success - userId/pw mismatch takes precedence over expiry
}