Package org.jasypt.util.password

Examples of org.jasypt.util.password.BasicPasswordEncryptor.encryptPassword()


public class PasswordUtils {

  public static String encodePassword(String password)
  {
    BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
    String encryptedPassword = passwordEncryptor.encryptPassword(password);
   
    return encryptedPassword;
  }
 
  public static boolean checkPassword(String plainPassword, String encryptedPassword)
View Full Code Here


  public void testPasswordEncryptionUsingBasicEncryptor() throws Exception {
    // Declare a basic encryptor
    BasicPasswordEncryptor bpe = new BasicPasswordEncryptor();
    // "Encrypt password", is not an real encryption because "Encryptor"
    // generate a digest. by default the MD5 algorithm is used
    String encryptedPassword = bpe.encryptPassword(TEXT_TO_ENCRYPT);
    System.out.printf("testPasswordEncryptionUsingBasicEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedPassword);
    // Valid "encrypted" password
    Assert.assertTrue(bpe.checkPassword(TEXT_TO_ENCRYPT, encryptedPassword));
  }
View Full Code Here

            String usuarioSkype)throws Exception{

        Usuario usu = new Usuario();
        usu.setNombreUsuario(nombre);
        BasicPasswordEncryptor  encriptador = new BasicPasswordEncryptor ();
        String passEncriptada = encriptador.encryptPassword(password);
        usu.setPassword(passEncriptada);
        usu.setUsuariosSkype(usuarioSkype);
        usu.setFechaRegistro(new Date());
        usu.setEmail(email);
        PermisosUsuarioDAO permUsuDAO = new PermisosUsuarioDAO();
View Full Code Here

    userLogDao.logResetPassword(user, moderator);
  }

  private String setPassword(User user, String password) {
    PasswordEncryptor encryptor = new BasicPasswordEncryptor();
    String encryptedPassword = encryptor.encryptPassword(password);

    jdbcTemplate.update("UPDATE users SET passwd=?, lostpwd = 'epoch' WHERE id=?",
        encryptedPassword, user.getId());

    return password;
View Full Code Here

              "(id, name, nick, passwd, url, email, town, score, max_score,regdate) " +
              "VALUES (?,?,?,?,?,?,?,45,45,current_timestamp)",
            userid,
            name,
            nick,
            encryptor.encryptPassword(password),
            url==null?null: URLUtil.fixURL(url),
            mail.getAddress(),
            town
    );
View Full Code Here

    BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
    userUpdate = usersRepository.findOne(id);
    if (userUpdate == null || !userUpdate.getEnabled()){
      return false;
    } else {
      userUpdate.setPassword(passwordEncryptor.encryptPassword(password));
      save(userUpdate.getId(), userUpdate);
    }

    return true;
  }
View Full Code Here

    UsersService usersService = ctx.getBean("usersService", UsersService.class);
    PreferencesService preferenceService = ctx.getBean("preferencesService", PreferencesService.class);

    BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor();
    String encryptedPassword = passwordEncryptor.encryptPassword(request.getParameter("pw"));

    if(usersService.findById(request.getParameter("un")) != null) {
      request.setAttribute("registrationMessage", "Username is already taken please regiser with another user name.");
      String url = "/Register.jsp";
      RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.