private void deletePassword(Password password) { try { pm.delete(password); } catch (PersistenceManagerException e) { _log.error("Unable to delete password", e); } }
public void saveHashedPassword(Password editor) { try { if (editor instanceof PasswordImpl) { PasswordImpl pass = (PasswordImpl) editor; pm.saveOrUpdate(pass); } } catch (PersistenceManagerException e) { _log.error("Unable to create or update password for user", e); } }
/** * This method returns the <code>PasswordImpl</code> associated with a user and is called * internally by other methods in this class. */ private PasswordImpl getPasswordImpl(User user) { PasswordImpl password = null; String query = "select pw from " + this.userPasswordImpl + " pw where pw.sportletUser.oid='" + user.getID() + "'"; try { password = (PasswordImpl) pm.restore(query); } catch (PersistenceManagerException e) { _log.error("Unable to retrieve password for user", e); } return password; }
public void savePassword(Password editor) { try { if (editor instanceof PasswordImpl) { PasswordImpl pass = (PasswordImpl) editor; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(pass.getValue().getBytes()); String value = toHex(md5.digest()); pass.setValue(value); } catch (NoSuchAlgorithmException e) { throw new PersistenceManagerException("Can't get MD5 algorithm! " + e.getMessage()); } pm.saveOrUpdate(pass); } } catch (PersistenceManagerException e) { _log.error("Unable to create or update password for user", e); } }