private void cleanup() { authSucceeded = false; username = null; password = null; principal = null; pam.dispose(); } }
private void cleanup() { _authSucceeded = false; _username = null; _password = null; _principal = null; _pam.dispose(); } }
private void cleanup() { _authSucceeded = false; _username = null; Arrays.fill(_passwordchar, ' '); _principal = null; _pam.dispose(); } }
@Override protected void finalize() throws Throwable { super.finalize(); dispose(); }
@Override protected void finalize() throws Throwable { super.finalize(); dispose(); }
@Override protected void finalize() throws Throwable { super.finalize(); dispose(); }
@Override public void authenticate(String user, String password) throws UserAuthenticationException { for (String profile : profiles) { PAM pam = null; try { pam = new PAM(profile); pam.authenticate(user, password); } catch (PAMException ex) { logger.error("PAM auth failed for user: {} against {} profile. Exception: {}", user, profile, ex.getMessage()); throw new UserAuthenticationException(String.format("PAM auth failed for user: %s using profile: %s", user, profile)); } finally { if (pam != null) { pam.dispose(); } } // No need to check for null unixUser as in case of failure we will not reach here. logger.trace("PAM authentication was successful for user: {} using profile: {}", user, profile); } }
@Override public Account authenticate(final String username, final String password) { PAM pam = null; try { pam = new PAM(serviceName); pam.authenticate(username, password); log.debug("Authentication succeeded for '{}' against '{}'", username, getRealmName()); Account account = new Account(null, new StandardCredentials(username, password)); cacheAccount(account); return account; } catch (PAMException e) { log.debug("Authentication failed for '{}' against '{}'", username, getRealmName()); log.error(e.getMessage()); } finally { if (pam != null) { pam.dispose(); } } return null; }