Examples of RandomNumberGenerator


Examples of org.apache.shiro.crypto.RandomNumberGenerator

    final List<?> result = query.list();

    if (result.size() == 0)
    {
      final Account account = new Account(username, password, "buddy@waddya.at");
      final RandomNumberGenerator random = new SecureRandomNumberGenerator();

      account.setSalt(random.nextBytes().toBase64());
      account.setPassword(new Sha256Hash(account.getPassword(), account.getSalt(), 1024).toBase64());

      session.save(account);
    }
  }
View Full Code Here

Examples of org.apache.shiro.crypto.RandomNumberGenerator

    final Session session = DatabaseUtil.getSessionFactory().getCurrentSession();
    final Account existingAccount = getAccount(session, account.getUsername());

    if (existingAccount == null)
    {
      final RandomNumberGenerator random = new SecureRandomNumberGenerator();
      account.setSalt(random.nextBytes().toBase64());
      account.setPassword(new Sha256Hash(account.getPassword(), account.getSalt(), 1024).toBase64());
    }
    else
    {
      // Don't allow password changes during an account update.
View Full Code Here

Examples of org.apache.shiro.crypto.RandomNumberGenerator

    public static boolean exists(User user) {
        return user != null && find.where().eq("admin.id", user.id).findRowCount() > 0;
    }

    public static User updateDefaultSiteAdmin(User user) {
        RandomNumberGenerator rng = new SecureRandomNumberGenerator();
        String passwordSalt = Arrays.toString(rng.nextBytes().getBytes());

        User defaultSiteAdmin = User.findByLoginId(SITEADMIN_DEFAULT_LOGINID);
        defaultSiteAdmin.name = user.name;
        defaultSiteAdmin.email = user.email;
        defaultSiteAdmin.passwordSalt = passwordSalt;
View Full Code Here

Examples of org.apache.shiro.crypto.RandomNumberGenerator

            newUserForm.reject("email", "user.email.duplicate");
        }
    }

    private static User createNewUser(User user) {
        RandomNumberGenerator rng = new SecureRandomNumberGenerator();
        user.passwordSalt = rng.nextBytes().toBase64();
        user.password = hashedPassword(user.password, user.passwordSalt);
        User.create(user);
        if (isUseSignUpConfirm()) {
            user.changeState(UserState.LOCKED);
        } else {
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.