/** * Method description * * @param user */ private void encryptPassword(User user) { String password = user.getPassword(); if (Util.isNotEmpty(password)) { user.setPassword(encryptionHandler.encrypt(password)); } }
private User getUser(String userName) { User user = new User(); user.setName(userName); user.setType(CarbonAuthHandler.TYPE); user.setDisplayName(userName); user.setMail("*****@*****.**"); // we have to just pass an email to get this passed. return user; }
/** * Method description * * @param users * @return */ @Override protected Collection<User> prepareForReturn(Collection<User> users) { if (Util.isNotEmpty(users)) { for (User u : users) { u.setPassword(DUMMY_PASSWORT); } } return users; }
/** * Method description * * @param user */ @Override protected void preUpate(User user) { if (DUMMY_PASSWORT.equals(user.getPassword())) { User o = manager.get(user.getName()); AssertUtil.assertIsNotNull(o); user.setPassword(o.getPassword()); } else { encryptPassword(user); } }
/** * Method description * * @param user * @return */ @Override protected String getId(User user) { return user.getName(); }
/** * Method description * * @param user * @return */ @Override protected User prepareForReturn(User user) { user.setPassword(DUMMY_PASSWORT); return user; }