change ldap password throgh jndi
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Joydeep_Chowdhury
Posted On:   Tuesday, March 27, 2001 11:04 AM

How can I change ldap password through cleartext jndi api ?

thanks.

Re: change ldap password throgh jndi

Posted By:   Andrew_Westbrook  
Posted On:   Tuesday, August 28, 2001 09:50 AM

I am able to do this by setting the "userpassword" attribute to the new password. The following example sets the password for a user who's complete DN is in ldapDN to newPassword using a DirContext object named ldapContext. Note that ldapContext must be authenticated.


Attributes newPassAttributes = new BasicAttributes( PASSWORD_ATTRIBUTE, newPassword);
try {
ldapContext.modifyAttributes(ldapDN,
ldapContext.REPLACE_ATTRIBUTE, newPassAttributes);
} catch (NamingException e) {
errorMessage = "Could not change password. " + e.getMessage();
return false;
}
About | Sitemap | Contact