Examples of PasswordEncoder


Examples of org.springframework.security.crypto.password.PasswordEncoder

        }
    }

    private boolean verifyPassword(String username, String presentedPassword,
            String encodedPassword) {
        PasswordEncoder passwordEncoder = new StandardPasswordEncoder(username);
        if (passwordEncoder.matches(presentedPassword, encodedPassword)) {
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

Examples of org.springframework.security.crypto.password.PasswordEncoder

        User user = userDao.findByCode(userId);
        if (user != null) {
            List<PwdLog> list = userPwdHistoryDao.findByUserCode(
                    user.getOid(), maxHistory);
            int i = 0;
            PasswordEncoder passwordEncoder = new StandardPasswordEncoder(
                    userId);
            for (PwdLog h : list) {
                // user status 不為 1 時,check change interval: 最近一次變更不得小於間隔
                if (i == 0 && !"1".equals(user.getStatus()) && !forcePwdChange) {
                    if (CapDate.calculateDays(Calendar.getInstance().getTime(),
                            h.getUpdateTime()) <= changeInteval) {
                        throw new CapMessageException(CapAppContext.getMessage(
                                "error.005", new Object[] { changeInteval }),
                                getClass());
                    }
                }
                if (passwordEncoder.matches(password, h.getPassword())) {
                    throw new CapMessageException(CapAppContext.getMessage(
                            "error.003", new Object[] { maxHistory }),
                            getClass());
                }
                i++;
View Full Code Here

Examples of org.springframework.security.crypto.password.PasswordEncoder

    }// ;

    @Override
    public boolean validatePassword(String userId, String password) {
        User user = userDao.findByCode(userId);
        PasswordEncoder passwordEncoder = new StandardPasswordEncoder(userId);
        return passwordEncoder.matches(password, user.getPassword());
    }
View Full Code Here

Examples of org.springframework.security.providers.encoding.PasswordEncoder

        boolean doEncrypt = Boolean.valueOf(encryptPasswords).booleanValue();
       
        if (doEncrypt) {
            DaoAuthenticationProvider provider = (DaoAuthenticationProvider) ctx.getBean("org.springframework.security.providers.dao.DaoAuthenticationProvider#0");
            String algorithm = WebloggerConfig.getProperty("passwds.encryption.algorithm");
            PasswordEncoder encoder = null;
            if (algorithm.equalsIgnoreCase("SHA")) {
                encoder = new ShaPasswordEncoder();
            } else if (algorithm.equalsIgnoreCase("MD5")) {
                encoder = new Md5PasswordEncoder();
            } else {
View Full Code Here

Examples of org.springframework.security.providers.encoding.PasswordEncoder

    syncedUser.setDescription( proxyUser.getDescription() );

    // PPP-1527: Password is never sent back to the UI. It always shows as blank. If the user leaves it blank,
    // password is not changed. If the user enters a value, set the password.
    if ( !StringUtils.isBlank( proxyUser.getPassword() ) ) {
      PasswordEncoder encoder =
          PentahoSystem.get( PasswordEncoder.class, "passwordEncoder", PentahoSessionHolder.getSession() ); //$NON-NLS-1$
      syncedUser.setPassword( encoder.encodePassword( proxyUser.getPassword(), null ) );
    }
    syncedUser.setEnabled( proxyUser.getEnabled() );
    return syncedUser;
  }
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.