// provided password was correct.
try
{
PasswordPolicyState pwPolicyState =
new PasswordPolicyState(userEntry, false);
if (! pwPolicyState.passwordMatches(ByteString.valueOf(password)))
{
bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS);
Message message = ERR_SASLPLAIN_INVALID_PASSWORD.get();
bindOperation.setAuthFailureReason(message);