I have created a Password Policy on OpenDJ LDAP and let's say that if I assigned that Password Policy to a user ('test1'), OpenDJ is going to lock out 'test1' after 3 wrong passwords. I have the confirmation that the Password Policy works well as I tested it using OpenAM and it generates me the pwdFailureTime every time that I tried to authenticate 'test1' via OpenAM with a wrong password and lockout 'test1' after 3 wrong attempts.
My problem is that if I use UnboundID SDK API as following using the 'cn=Directory Manager' admin user for the connection to OpenDJ/LDAP and the user 'test1' to authenticate on OpenDJ, it doesn't work. OpenDJ is not generating me any value for pwdFailureTime when I provide the wrong password for 'test1' (debugging the 'Sentinelle 2').
Could someone have any idea what is going wrong here?
import com.unboundid.ldap.sdk.*;
import com.unboundid.ldap.sdk.controls.*;
public final class SimpleBindExample {
public static final String HOSTNAME = "redhat.tech.example.com";
public static final int PORT = 1389;
public static final String usrDN = "cn=Directory Manager";
public static final String usrPWD = "password";
public static final void main(final String... args) {
// Establish a connection to OpenDJ via the user: cn=Directory Manager
LDAPConnection ldapConnection = null;
try {
ldapConnection = new LDAPConnection(HOSTNAME, PORT, usrDN, usrPWD);
} catch(LDAPException ldapException) {
System.err.println(ldapException);
System.exit(ldapException.getResultCode().intValue());
}
try {
String testusr= "uid=test1,ou=people,dc=example,dc=com";
String testpwd = "password";
BindRequest bindRequest = new SimpleBindRequest(testusr,testpwd,new AuthorizationIdentityRequestControl());
BindResult bindResult = ldapConnection.bind(bindRequest);
System.out.println("Sentinelle 1: The user is authenticated!");
ldapConnection.close();
System.out.println(bindResult);
} catch(LDAPException ldapException) {
System.out.println("Sentinelle 2: The user is NOT authenticated!");
ldapConnection.close();
System.err.println(ldapException);
System.exit(ldapException.getResultCode().intValue());
}
}
}