Ejemplo n.º 1
0
 public static boolean validatePwd(String OldPwd, User user) {
   String oldPwd1 =
       new SimpleHash(
               algorithmName,
               OldPwd,
               ByteSource.Util.bytes(user.getCredentialsSalt()),
               hashIterations)
           .toHex();
   return oldPwd1.equals(user.getPassword());
 }
Ejemplo n.º 2
0
 public static void encryptPassword(User user) {
   user.setSalt(generator.nextBytes().toHex());
   String newPassword =
       new SimpleHash(
               algorithmName,
               user.getPassword(),
               ByteSource.Util.bytes(user.getCredentialsSalt()),
               hashIterations)
           .toHex();
   user.setPassword(newPassword);
 }