use of com.sun.enterprise.security.auth.realm.pam.PamRealm in project Payara by payara.
the class PamLoginModule method authenticate.
/**
* Invokes the authentication call.This class uses the default PAM service - sshd
*
* @param username OS User to authenticate.
* @param password Given password.
* @returns null if authentication failed, returns the UnixUser object if authentication succeeded.
*/
private UnixUser authenticate(String username, String password) throws LoginException {
UnixUser user = null;
String pamService = null;
if (_currentRealm instanceof PamRealm) {
pamService = ((PamRealm) _currentRealm).getPamService();
} else {
throw new LoginException("pamrealm.invalid_realm");
}
try {
user = new PAM(pamService).authenticate(username, password);
} catch (PAMException e) {
LOGGER.log(SEVERE, "pam_exception_authenticate", e);
}
return user;
}
Aggregations