use of eu.bcvsolutions.idm.core.api.dto.filter.IdmPasswordHistoryFilter in project CzechIdMng by bcvsolutions.
the class DefaultPasswordHistoryIntegrationTest method testFilteringByIdentityUsername.
@Test
public void testFilteringByIdentityUsername() {
String password = "password-" + System.currentTimeMillis();
GuardedString passwordAsGuardedString = new GuardedString(password);
// Change 1
IdmIdentityDto identity = testHelper.createIdentity(passwordAsGuardedString);
PasswordChangeDto passwordChange = new PasswordChangeDto();
passwordChange.setOldPassword(passwordAsGuardedString);
passwordChange.setAll(true);
passwordChange.setIdm(true);
passwordChange.setNewPassword(new GuardedString(password));
// Change 2
identityService.passwordChange(identity, passwordChange);
// Change 3
identityService.passwordChange(identity, passwordChange);
// Change 4
identityService.passwordChange(identity, passwordChange);
IdmPasswordHistoryFilter filter = new IdmPasswordHistoryFilter();
filter.setIdentityUsername(identity.getUsername());
List<IdmPasswordHistoryDto> content = passwordHistoryService.find(filter, null).getContent();
assertEquals(4, content.size());
filter = new IdmPasswordHistoryFilter();
filter.setIdentityId(identity.getId());
content = passwordHistoryService.find(filter, null).getContent();
assertEquals(4, content.size());
}
Aggregations