Examples of Md5PasswordEncoder


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

        existingProfile.setGeoLocation(profile.getGeoLocation());
        existingProfile.setVideoEmbeds(profile.getVideoEmbeds());
        existingProfile.setGravatarEmail(profile.getGravatarEmail());

        if (!StringUtils.isEmpty(profile.getGravatarEmail())) {
            Md5PasswordEncoder encoder = new Md5PasswordEncoder();
            String hashedEmail = encoder.encodePassword(profile.getGravatarEmail(), null);
            existingProfile.setAvatarUrl(String.format("http://gravatar.com/avatar/%s", hashedEmail));
        }

        teamRepository.save(existingProfile);
        try {
View Full Code Here

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

    @RequestMapping(value = "/register.do", method = RequestMethod.POST)
    public String addItemTemplate(@ModelAttribute("newUser") UserAuth userAuth,
                                  BindingResult result) {

        userAuth.setActive(true);
        Md5PasswordEncoder enc = new Md5PasswordEncoder();
        userAuth.setPasswordHash(enc.encodePassword(userAuth.getPasswordHash(), null));
        userService.createUser(userAuth);
        User user = new User();
        user.setId(userAuth.getUserId());
        service.addUser(user);
View Full Code Here

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

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

   * @param password
   *            - decoded password string
   */
  public void setAndEncodePassword(String password) {
    // create the encoder object
    Md5PasswordEncoder encoder = new Md5PasswordEncoder();
    encoder.setEncodeHashAsBase64(true);

    // encode the password using the unique user ID as the salt
    String encodedPassword = encoder.encodePassword(password, new Long(this.getId()));

    // set the password
    setPassword(encodedPassword);
  }
View Full Code Here

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

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

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

        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

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

        }
        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

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

            // 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

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

        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
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.