Esempio n. 1
0
  /**
   * Method description
   *
   * @param user
   */
  private void encryptPassword(User user) {
    String password = user.getPassword();

    if (Util.isNotEmpty(password)) {
      user.setPassword(encryptionHandler.encrypt(password));
    }
  }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
  /**
   * 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;
  }
Esempio n. 4
0
  /**
   * 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);
    }
  }
Esempio n. 5
0
 /**
  * Method description
  *
  * @param user
  * @return
  */
 @Override
 protected String getId(User user) {
   return user.getName();
 }
Esempio n. 6
0
  /**
   * Method description
   *
   * @param user
   * @return
   */
  @Override
  protected User prepareForReturn(User user) {
    user.setPassword(DUMMY_PASSWORT);

    return user;
  }