I decided to update the code in BasePortalToLDAPConverter.java to take into account what encryption approach is being used for Liferay.
Original code:
1 if (user.isPasswordModified() &&
2 Validator.isNotNull(user.getPasswordUnencrypted())) {
3
4 addModificationItem(
5 userMappings.getProperty(UserConverterKeys.PASSWORD),
6 user.getPasswordUnencrypted(), modifications);
7 }
Updated code:
1 if(PwdEncryptor.PASSWORDS_ENCRYPTION_ALGORITHM.equals(PwdEncryptor.TYPE_NONE)) {
2 String passwordUnencrypted = user.getPasswordUnencrypted();
3 if (user.isPasswordModified() &&
4 Validator.isNotNull(passwordUnencrypted)) {
5
6 addModificationItem(
7 userMappings.getProperty(UserConverterKeys.PASSWORD),
8 passwordUnencrypted, modifications);
9 }
10 } else {
11 String encryptedPassword = "{" + PwdEncryptor.PASSWORDS_ENCRYPTION_ALGORITHM + "}" + user.getPassword();
12 if (user.isPasswordModified() &&
13 Validator.isNotNull(encryptedPassword)) {
14
15 addModificationItem(
16 userMappings.getProperty(UserConverterKeys.PASSWORD),
17 encryptedPassword, modifications);
18 }
19 }
As you case see, the main change that I have made is to wrap the original code in the initial "if" clause. I have added supplemental code to the "else" clase, to handle the case where some type of encryption is being used. The result of this, is that when Liferay is using some type of encryption scheme, the password sent to the LDAP server will be of the form {ENCRYPTION_SCHEME}encryptedPassword however, when no entryption is being used, a plaintext password will be sent to the LDAP server as is currently the default implementation in all cases.
I have attached a class file compatible with Liferay Portal version liferay-portal-tomcat-6.0.6-20110225
Simply overwrite your existing class file with this new one to gain specified functionality. Until a better solution becomes available, I'll be sticking with this approach.
You can download the new class file here:
BasePortalToLDAPConverter.class