Package com.ketayao.ketacustom.shiro.ShiroDbRealm

Examples of com.ketayao.ketacustom.shiro.ShiroDbRealm.HashPassword


        throw new ExistedException("登录名:" + user.getUsername() + "已存在。");
      }
     
      //设定安全的密码,使用passwordService提供的salt并经过1024次 sha-1 hash
      if (StringUtils.isNotBlank(user.getPlainPassword()) && shiroRealm != null) {
        HashPassword hashPassword = ShiroDbRealm.encryptPassword(user.getPlainPassword());
        user.setSalt(hashPassword.salt);
        user.setPassword(hashPassword.password);
      }
    }
   
View Full Code Here


  @Override
  public void updatePwd(User user, String newPwd) throws ServiceException {
    //设定安全的密码,使用passwordService提供的salt并经过1024次 sha-1 hash
    boolean isMatch = ShiroDbRealm.validatePassword(user.getPlainPassword(), user.getPassword(), user.getSalt());
    if (isMatch) {
      HashPassword hashPassword = ShiroDbRealm.encryptPassword(newPwd);
      user.setSalt(hashPassword.salt);
      user.setPassword(hashPassword.password);
     
      userDAO.save(user);
      shiroRealm.clearCachedAuthorizationInfo(user.getUsername());
View Full Code Here

  public void resetPwd(User user, String newPwd) {
    if (newPwd == null) {
      newPwd = "123456";
    }
   
    HashPassword hashPassword = ShiroDbRealm.encryptPassword(newPwd);
    user.setSalt(hashPassword.salt);
    user.setPassword(hashPassword.password);
   
    userDAO.save(user);
  }
View Full Code Here

TOP

Related Classes of com.ketayao.ketacustom.shiro.ShiroDbRealm.HashPassword

Copyright © 2018 www.massapicom. 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.