checkBindSuccess( userDn, "12345" );
Entry entry = adminConnection.lookup( userDn, "*", "+" );
Attribute pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
assertNotNull( pwdHistAt );
assertEquals( 1, pwdHistAt.size() );
Thread.sleep( 1000 );// to avoid creating a history value with the same timestamp
Modification modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword",
"67891" );
adminConnection.modify( userDn, modification );
checkBindSuccess( userDn, "67891" );
entry = adminConnection.lookup( userDn, "*", "+" );
pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
assertNotNull( pwdHistAt );
assertEquals( 2, pwdHistAt.size() );
Thread.sleep( 1000 );// to avoid creating a history value with the same timestamp
modification = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword",
"abcde" );
adminConnection.modify( userDn, modification );
checkBindSuccess( userDn, "abcde" );
entry = adminConnection.lookup( userDn, "*", "+" );
pwdHistAt = entry.get( PasswordPolicySchemaConstants.PWD_HISTORY_AT );
assertNotNull( pwdHistAt );
// it should still hold only 2 values
assertEquals( 2, pwdHistAt.size() );
// try to reuse the password, should fail
try
{
adminConnection.modify( userDn, modification );