I'm having problems with how to save a password in Apache DS LDAP in an SSHA hash instead of plain text. As far as I can tell, the right way to do this is to configure Apache DS to use SSHA to store passwords, and then send only plain text when setting up the password. However, I cannot decide how to configure Apache DS for this.
I moved the Hashed password to LDAP (using the admin interface for LDAP), and Apache DS correctly authenticates against the correct password. However, I need to insert a password from our Java application. This may not be an unusual request, so I have to miss something.
Here is my code to set a password from java using the LdapTemplate interface from org.springframework.ldap.core
public void storeNewPassword(final String userId, final String password) {
final DistinguishedName dn = new DistinguishedName("dc=users,dc=pms,dc=com");
dn.add("uid", userId);
Attribute pass = new BasicAttribute("userpassword", password);
final ModificationItem mi = new ModificationItem(
DirContext.REPLACE_ATTRIBUTE,
pass);
ldapTemplate.modifyAttributes(dn, new ModificationItem[] {mi});
}
, Apache DS, , :
, - , , , Apache DS SSHA .