Package org.jasypt.util.password

Examples of org.jasypt.util.password.StrongPasswordEncryptor.checkPassword()


    StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();

    // Check the password against all matching Users
    for (User user : users) {
      if (passwordEncryptor.checkPassword(passwordDigest, user.getPasswordDigest())) {
        return Optional.of(initialized(user));
      }
    }

    // Must have failed to be here
View Full Code Here


    // "Encrypt password", is not an real encryption because "Encryptor"
    // generate a digest. by default the SHA-256 algorithm is used
    String encryptedPassword = pe.encryptPassword(TEXT_TO_ENCRYPT);
    System.out.printf("testPasswordEncryptionUsingStrongEncryptor : '%s' become '%s'\n", TEXT_TO_ENCRYPT, encryptedPassword);
    // Valid "encrypted" password
    Assert.assertTrue(pe.checkPassword(TEXT_TO_ENCRYPT, encryptedPassword));
  }

  /**
   * This test show how encrypt a password using a configurable encryptor.
   *
 
View Full Code Here

        final String passw2 = "cry301"; // NOPMD by r39 on 3/30/11 1:28 PM

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
        logger.debug(bpe.checkPassword(passw2, encrypted2));

        logger.debug(encrypted1.length());
View Full Code Here

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
        logger.debug(bpe.checkPassword(passw2, encrypted2));

        logger.debug(encrypted1.length());
        logger.debug(encrypted2.length());
View Full Code Here

        final String encrypted1 = bpe.encryptPassword(passw1);
        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
        logger.debug(bpe.checkPassword(passw2, encrypted2));

        logger.debug(encrypted1.length());
        logger.debug(encrypted2.length());
View Full Code Here

        final String encrypted2 = bpe.encryptPassword(passw2);

        logger.debug(bpe.checkPassword(passw1, encrypted1));
        logger.debug(bpe.checkPassword(passw1, encrypted2));
        logger.debug(bpe.checkPassword(passw2, encrypted1));
        logger.debug(bpe.checkPassword(passw2, encrypted2));

        logger.debug(encrypted1.length());
        logger.debug(encrypted2.length());

    }
View Full Code Here

  private boolean isPasswordValid(String password) {
    String encryptedPassword = adminPasswordStore.getPassword();

    if (encryptedPassword != null) {
      StrongPasswordEncryptor encryptor = new StrongPasswordEncryptor();
      return encryptor.checkPassword(password, encryptedPassword);
    } else {
      if ("admin".equals(password)) {
        return true;
      }
    }
View Full Code Here

  private boolean isPasswordValid(String password) {
    String encryptedPassword = adminPasswordStore.getPassword();

    if (encryptedPassword != null) {
      StrongPasswordEncryptor encryptor = new StrongPasswordEncryptor();
      return encryptor.checkPassword(password, encryptedPassword);
    } else {
      if ("admin".equals(password)) {
        return true;
      }
    }
View Full Code Here

     * @param encryptedPassword encrypted password
     * @return if correct true and if not false
     */
    public static final Boolean checkPassword(final String inputPassword, final String encryptedPassword ){
        final StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor();
        if (passwordEncryptor.checkPassword(inputPassword, encryptedPassword)) {
            // correct
            return true;
          } else {
            // bad password
            return false;
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.