PAM pam = null;
try {
String serviceName = settings.getString(Keys.realm.pam.serviceName, "system-auth");
pam = new PAM(serviceName);
pam.authenticate(username, new String(password));
} catch (PAMException e) {
logger.error(e.getMessage());
return null;
} finally {
if (pam != null) {