ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsManager.java
public void changePassword(final String oldPassword, final String newPassword) {
		Authentication authentication = SecurityContextHolder.getContext()
				.getAuthentication();
		Assert.notNull(
				authentication,
				"No authentication object found in security context. Can't change current user's password!");

		String username = authentication.getName();

		logger.debug("Changing password for user '" + username);

		DistinguishedName userDn = usernameMapper.buildDn(username);

		if (usePasswordModifyExtensionOperation) {
			changePasswordUsingExtensionOperation(userDn, oldPassword, newPassword);
		} else {
			changePasswordUsingAttributeModification(userDn, oldPassword, newPassword);
		}
	}
public void changePassword(final String oldPassword, final String newPassword) {
		Authentication authentication = SecurityContextHolder.getContext()
				.getAuthentication();
		Assert.notNull(
				authentication,
				"No authentication object found in security context. Can't change current user's password!");

		String username = authentication.getName();

		logger.debug("Changing password for user '" + username);

		DistinguishedName userDn = usernameMapper.buildDn(username);

		if (usePasswordModifyExtensionOperation) {
			changePasswordUsingExtensionOperation(userDn, oldPassword, newPassword);
		} else {
			changePasswordUsingAttributeModification(userDn, oldPassword, newPassword);
		}
	}
Changes the password for the current user. The username is obtained from the
security context.

There are two supported strategies for modifying the user's password depending on
the capabilities of the corresponding LDAP server.

<p>
Configured one way, this method will modify the user's password via the
<a target="_blank" href="https://tools.ietf.org/html/rfc3062">
LDAP Password Modify Extended Operation
</a>.

See {@link LdapUserDetailsManager#setUsePasswordModifyExtensionOperation(boolean)} for details.
</p>

<p>
By default, though, if the old password is supplied, the update will be made by rebinding as the user,
thus modifying the password using the user's permissions. If
<code>oldPassword</code> is null, the update will be attempted using a standard
read/write context supplied by the context source.
</p>

@param oldPassword the old password
@param newPassword the new value of the password.