VerifyPasswordCallback vpc = (VerifyPasswordCallback) current;
vpc.setVerified(password.equals(vpc.getPassword()));
} else if (current instanceof DigestHashCallback) {
DigestHashCallback dhc = (DigestHashCallback) current;
try {
UsernamePasswordHashUtil uph = new UsernamePasswordHashUtil();
if (userName == null || realm == null) {
throw new SaslException("Insufficient information to generate hash.");
}
dhc.setHash(uph.generateHashedURP(userName, realm, password.toCharArray()));
} catch (NoSuchAlgorithmException e) {
throw new SaslException("Unable to generate hash", e);
}
}
}