Package org.ejbca.core.ejb.ra

Examples of org.ejbca.core.ejb.ra.UserData.comparePassword()


      UserData data = new UserData();
      data.setPassword("foo123");
      String hash = data.getPasswordHash();
      // Check that it by default generates a strong bcrypt password hash
      assertTrue(hash.startsWith("$2"));
      assertFalse(data.comparePassword("bar123"));
      assertTrue(data.comparePassword("foo123"));
      // Set the same password again, it should be another hash this time
      data.setPassword("foo123");
      String hash1 = data.getPasswordHash();
      assertTrue(hash1.startsWith("$2"));
View Full Code Here


      data.setPassword("foo123");
      String hash = data.getPasswordHash();
      // Check that it by default generates a strong bcrypt password hash
      assertTrue(hash.startsWith("$2"));
      assertFalse(data.comparePassword("bar123"));
      assertTrue(data.comparePassword("foo123"));
      // Set the same password again, it should be another hash this time
      data.setPassword("foo123");
      String hash1 = data.getPasswordHash();
      assertTrue(hash1.startsWith("$2"));
      assertFalse(hash1.equals(hash));
View Full Code Here

      assertFalse(hash1.equals(hash));

      // Now check that we can still use old password hashes transparently usgin the old fixed sha1 hash of foo123
      data.setPasswordHash("3b303d8b0364d9265c06adc8584258376150c9b5");
      assertEquals("3b303d8b0364d9265c06adc8584258376150c9b5", data.getPasswordHash());
      assertFalse(data.comparePassword("bar123"));
      assertTrue(data.comparePassword("foo123"));

      // Check that set clear text password works as well
      data.setOpenPassword("primekey");
      hash = data.getPasswordHash();
View Full Code Here

      // Now check that we can still use old password hashes transparently usgin the old fixed sha1 hash of foo123
      data.setPasswordHash("3b303d8b0364d9265c06adc8584258376150c9b5");
      assertEquals("3b303d8b0364d9265c06adc8584258376150c9b5", data.getPasswordHash());
      assertFalse(data.comparePassword("bar123"));
      assertTrue(data.comparePassword("foo123"));

      // Check that set clear text password works as well
      data.setOpenPassword("primekey");
      hash = data.getPasswordHash();
      // Check that it by default generates a strong bcrypt password hash
View Full Code Here

      // Check that set clear text password works as well
      data.setOpenPassword("primekey");
      hash = data.getPasswordHash();
      // Check that it by default generates a strong bcrypt password hash
      assertTrue(hash.startsWith("$2"));
      assertFalse(data.comparePassword("foo123123"));
      assertTrue(data.comparePassword("primekey"));
      assertEquals("primekey", data.getClearPassword());

    }
View Full Code Here

      data.setOpenPassword("primekey");
      hash = data.getPasswordHash();
      // Check that it by default generates a strong bcrypt password hash
      assertTrue(hash.startsWith("$2"));
      assertFalse(data.comparePassword("foo123123"));
      assertTrue(data.comparePassword("primekey"));
      assertEquals("primekey", data.getClearPassword());

    }

}
View Full Code Here

             final int status = data.getStatus();
            if ( (status == UserDataConstants.STATUS_NEW) || (status == UserDataConstants.STATUS_FAILED) || (status == UserDataConstants.STATUS_INPROCESS) || (status == UserDataConstants.STATUS_KEYRECOVERY)) {
              if (log.isDebugEnabled()) {
                log.debug("Trying to authenticate user: username="+username+", dn="+data.getSubjectDN()+", email="+data.getSubjectEmail()+", status="+status+", type="+data.getType());
              }
                if (!data.comparePassword(password)) {
                  final String msg = intres.getLocalizedMessage("authentication.invalidpwd", username);             
                  logSession.log(admin, data.getCaId(), LogConstants.MODULE_CA, new Date(),username, null, LogConstants.EVENT_ERROR_USERAUTHENTICATION,msg);
                  throw new AuthLoginException(msg);
                }
                // Resets the remaining login attempts as this was a successful login
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.