Package org.jasypt.encryption.pbe.config

Examples of org.jasypt.encryption.pbe.config.WebPBEConfig


       
        Iterator configsIter = configs.iterator();
        int i = 0;
        while (configsIter.hasNext()) {
           
            WebPBEConfig config =
                (WebPBEConfig) configsIter.next();
           
            if (!config.isComplete()) {
                throw new EncryptionInitializationException("Incomplete " +
                        "WebPBEConfig object: all configs must specify " +
                        "both a name and a validation word");
            }
           
            strBuff.append("     <fieldset>\n");
            strBuff.append("      <legend>" + config.getName() + "</legend>\n");
            strBuff.append("      <label for=\"" + VALIDATION_PREFIX + i + "\">Validation word</label>: <input type=\"password\" name=\"" + VALIDATION_PREFIX + i + "\" />\n");
            strBuff.append("      <br /><br />\n");
            strBuff.append("      <label for=\"" + PASSWORD_PREFIX + i + "\">Password</label>: <input type=\"password\" name=\"" + PASSWORD_PREFIX + i + "\" />\n");
            strBuff.append("      <br /><br />\n");
            strBuff.append("      <label for=\"" + PASSWORD_RETYPED_PREFIX + i + "\">Retype password</label>: <input type=\"password\" name=\"" + PASSWORD_RETYPED_PREFIX + i + "\" />\n");
View Full Code Here


                    Iterator configsIter = configs.iterator();
                    int i = 0;
                    int valid = 0;
                    while (configsIter.hasNext()) {

                        WebPBEConfig config = (WebPBEConfig) configsIter.next();
                       
                        String validation =
                            req.getParameter(WebPBEConfigHtmlUtils.VALIDATION_PREFIX + i);
                        String password =
                            req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_PREFIX + i);
                        String retypedPassword =
                            req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_RETYPED_PREFIX + i);
                       
                        if (!StringUtils.isEmpty(validation) &&
                            !StringUtils.isEmpty(password)   &&
                            password.equals(retypedPassword)   &&
                            (config.getValidationWord().equals(validation))) {
                            /*
                             * Passwords will not be set here, instead, we will
                             * wait until ALL the passwords are set correctly,
                             * to avoid a partial initialization.
                             */
                            valid++;
                        }
                   
                        i++;
                       
                    }

                    SimpleDateFormat dateFormat = new SimpleDateFormat();
                    Calendar now = Calendar.getInstance();
                   
                    if (valid < configs.size()) {

                        /*
                         * Bad attempt: log and show error.
                         */
                       
                        this.getServletContext().log(
                                "Failed attempt to set PBE Configuration from " +
                                req.getRemoteAddr() +
                                " [" + dateFormat.format(now.getTime()) + "]");
                       
                        writeResponse(
                                WebPBEConfigHtmlUtils.createInputFormHtml(req, true),
                                resp);
                       
                    } else {

                        /*
                         * Success: log, set passwords and show success page.
                         */
                       
                        configsIter = configs.iterator();
                        i = 0;
                        while (configsIter.hasNext()) {
                            WebPBEConfig config = (WebPBEConfig) configsIter.next();
                            String password =
                                req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_PREFIX + i);
                            config.setPassword(password);
                            i++;
                        }
                       
                        registry.setWebConfigurationDone(true);

View Full Code Here

       
        final Iterator configsIter = configs.iterator();
        int i = 0;
        while (configsIter.hasNext()) {
           
            WebPBEConfig config =
                (WebPBEConfig) configsIter.next();
           
            if (!config.isComplete()) {
                throw new EncryptionInitializationException("Incomplete " +
                        "WebPBEConfig object: all configs must specify " +
                        "both a name and a validation word");
            }
           
            strBuff.append("     <fieldset>\n");
            strBuff.append("      <legend>" + config.getName() + "</legend>\n");
            strBuff.append("      <label for=\"" + VALIDATION_PREFIX + i + "\">Validation word</label>: <input type=\"password\" name=\"" + VALIDATION_PREFIX + i + "\" />\n");
            strBuff.append("      <br /><br />\n");
            strBuff.append("      <label for=\"" + PASSWORD_PREFIX + i + "\">Password</label>: <input type=\"password\" name=\"" + PASSWORD_PREFIX + i + "\" />\n");
            strBuff.append("      <br /><br />\n");
            strBuff.append("      <label for=\"" + PASSWORD_RETYPED_PREFIX + i + "\">Retype password</label>: <input type=\"password\" name=\"" + PASSWORD_RETYPED_PREFIX + i + "\" />\n");
View Full Code Here

                    Iterator configsIter = configs.iterator();
                    int i = 0;
                    int valid = 0;
                    while (configsIter.hasNext()) {

                        final WebPBEConfig config = (WebPBEConfig) configsIter.next();
                       
                        final String validation =
                            req.getParameter(WebPBEConfigHtmlUtils.VALIDATION_PREFIX + i);
                        final String password =
                            req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_PREFIX + i);
                        final String retypedPassword =
                            req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_RETYPED_PREFIX + i);
                       
                        if (!CommonUtils.isEmpty(validation) &&
                            !CommonUtils.isEmpty(password)   &&
                            password.equals(retypedPassword)   &&
                            (config.getValidationWord().equals(validation))) {
                            /*
                             * Passwords will not be set here, instead, we will
                             * wait until ALL the passwords are set correctly,
                             * to avoid a partial initialization.
                             */
                            valid++;
                        }
                   
                        i++;
                       
                    }

                    final SimpleDateFormat dateFormat = new SimpleDateFormat();
                    final Calendar now = Calendar.getInstance();
                   
                    if (valid < configs.size()) {

                        /*
                         * Bad attempt: log and show error.
                         */
                       
                        this.getServletContext().log(
                                "Failed attempt to set PBE Configuration from " +
                                req.getRemoteAddr() +
                                " [" + dateFormat.format(now.getTime()) + "]");
                       
                        writeResponse(
                                WebPBEConfigHtmlUtils.createInputFormHtml(req, true),
                                resp);
                       
                    } else {

                        /*
                         * Success: log, set passwords and show success page.
                         */
                       
                        configsIter = configs.iterator();
                        i = 0;
                        while (configsIter.hasNext()) {
                            WebPBEConfig config = (WebPBEConfig) configsIter.next();
                            String password =
                                req.getParameter(WebPBEConfigHtmlUtils.PASSWORD_PREFIX + i);
                            config.setPassword(password);
                            i++;
                        }
                       
                        registry.setWebConfigurationDone(true);

View Full Code Here

TOP

Related Classes of org.jasypt.encryption.pbe.config.WebPBEConfig

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.