Able to login using Old password in LDAP
<p>We are using LDAP for windows authentication in our application. </p>

<p>The code looks like</p>

<pre><code>public LdapContext adAuth(String userName, String passWord, String domainName, String url,String port) {
    LdapContext ctx = null;
    try{
        Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://"+url+":"+port);
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, userName + "@" + domainName );
        env.put(Context.SECURITY_CREDENTIALS, passWord);
        ctx = new InitialLdapContext(env, null);
    }catch(NamingException nex){
        ctx = null;
    }
    return ctx;
}
</code></pre>

<p>This is working fine. But the issue is when a user changes his password and setup a new password he is able to login using the new password and <strong><em>OLD</em></strong> password. How do i prevent this? User should be able to login using the new password only.</p>