Package org.springframework.security.authentication.encoding

Examples of org.springframework.security.authentication.encoding.Md5PasswordEncoder


        this.password = encode(password);
        this.roles = roles;
    }

    private String encode(String password) {
        return new Md5PasswordEncoder().encodePassword(password, SALT);
    }
View Full Code Here


        this.password = encode(password);
        this.roles = roles;
    }

    private String encode(String password) {
        return new Md5PasswordEncoder().encodePassword(password, SALT);
    }
View Full Code Here

        User reportTo = null;
        if (reportToID != null) {
            reportTo = baseService.getEntityById(User.class, reportToID);
        }
        user.setReport_to(reportTo);
        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
        if (user.getId() != null) {
            UserUtil.permissionCheck("update_system");
            User originalUser = baseService.getEntityById(User.class,
                    user.getId());
            String oldPassword = originalUser.getPassword();
            if (!oldPassword.equalsIgnoreCase(user.getPassword())) {
                user.setPassword(encoder.encodePassword(user.getPassword(),
                        AuthenticationFilter.SALT));
            }
            user.setRoles(originalUser.getRoles());
            user.setTargetLists(originalUser.getTargetLists());
            user.setCalls(originalUser.getCalls());
            user.setMeetings(originalUser.getMeetings());
            user.setCreated_on(originalUser.getCreated_on());
            user.setCreated_by(originalUser.getCreated_by());
        } else {
            UserUtil.permissionCheck("create_system");
            user.setPassword(encoder.encodePassword(user.getPassword(),
                    AuthenticationFilter.SALT));
        }
        super.updateBaseInfo(user);
    }
View Full Code Here

        }
        ActionContext context = ActionContext.getContext();
        Map<String, Object> session = context.getSession();
        User loginUser = (User) session
                .get(AuthenticationSuccessListener.LOGIN_USER);
        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
        String encodePassword = encoder.encodePassword(oldPassword,
                AuthenticationFilter.SALT);
        if (!encodePassword.equals(loginUser.getPassword())) {
            this.addActionError(this
                    .getText("changePassword.wrong.oldPassword"));
            return INPUT;
        }
        encodePassword = encoder.encodePassword(newPassword,
                AuthenticationFilter.SALT);
        loginUser.setPassword(encodePassword);
        baseService.makePersistent(loginUser);
        this.addActionError(this.getText("changePassword.password.success"));
        return SUCCESS;
View Full Code Here

            // Generates a random user password
            String newPassword = CommonUtil.randomString(6);

            // Saves the new password
            User user = users.get(0);
            Md5PasswordEncoder encoder = new Md5PasswordEncoder();
            user.setPassword(encoder.encodePassword(newPassword,
                    AuthenticationFilter.SALT));
            this.makePersistent(user);

            // Sends the new password to user
            mailService.sendSystemSimpleMail(email, subject, content
View Full Code Here

        request.getSession().setAttribute("WW_TRANS_I18N_LOCALE", locale);
        request.getSession().setAttribute("locale", localValue);
        Locale.setDefault(locale);

        User user = UserUtil.getUser(username);
        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
        password = encoder.encodePassword(password, AuthenticationFilter.SALT);
        if (user == null || !user.getPassword().equals(password)) {
            ResourceBundle rb = CommonUtil.getResourceBundle();
            String errorMessage = rb.getString("error.login.denied");
            throw new AuthenticationServiceException(errorMessage);
        }
View Full Code Here

  CustomUserDetailsService customUserDetailsService;


  public String getMD5EncodedPasswordHash(String pass) {
    try {
      PasswordEncoder encoder = new Md5PasswordEncoder();
      String hashedPass = encoder.encodePassword(pass, null);
      return hashedPass.toLowerCase();
    }
    catch (Exception e) {

    }
View Full Code Here


  @Override
  public String encodePassword(String rawPass, Object salt) {
    try {
      PasswordEncoder encoder = new Md5PasswordEncoder();
      String hashedPass = encoder.encodePassword(rawPass, null);
      return hashedPass.toLowerCase();
    }
    catch (Exception e) {

    }
View Full Code Here

        System.out.println("机器码:"+code);
        System.out.println("注册码:"+authCode);
    }
    public static String auth(String machineCode){
        String newCode="(yang-shangchuan@qq.com)["+machineCode.toUpperCase()+"](APDPlat应用级产品开发平台)";
        String code = new Md5PasswordEncoder().encodePassword(newCode,"杨尚川").toUpperCase()+machineCode.length();
        return getSplitString(code);
    }
View Full Code Here

        System.out.println("机器码:"+code);
        System.out.println("注册码:"+authCode);
    }
    public static String auth(String machineCode){
        String newCode="(yang-shangchuan@qq.com)["+machineCode.toUpperCase()+"](APDPlat应用级产品开发平台)";
        String code = new Md5PasswordEncoder().encodePassword(newCode,"杨尚川").toUpperCase()+machineCode.length();
        return getSplitString(code);
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.encoding.Md5PasswordEncoder

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.