Package com.adito.core

Examples of com.adito.core.FieldValidationException


        ActionErrors errors = new ActionErrors();
        try {
            User user = LogonControllerFactory.getInstance().getUser(request);
            UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(user.getRealm());
            if (getOldPassword().length() == 0) {
                throw new FieldValidationException("noOldPassword");
            }
            if (getOldPassword().equals(getNewPassword())) {
                throw new FieldValidationException("newAndOldPasswordMatch");
            }
            if (!getNewPassword().equals(getConfirmPassword())) {
                throw new FieldValidationException("newAndConfirmPasswordsDontMatch");
            }
            if (getNewPassword().length() == 0) {
                throw new FieldValidationException("noNewPassword");
            }
            if (!udb.checkPassword(user.getPrincipalName(), getOldPassword())) {
                throw new FieldValidationException("oldPasswordIncorrect");
            } else {
                // Check that the password matches the current policy, if not
                // then request a new one
                try {
                    String pattern = Property.getProperty(new RealmKey("security.password.pattern", user.getRealm().getResourceId()));
                    Pattern p = Pattern.compile(pattern);
                    if (!p.matcher(newPassword).matches()) {
                        throw new FieldValidationException("doesNotMatchPolicy");
                    }
                } catch(FieldValidationException fve) {
                  throw fve;
                } catch (Exception e) {
                    throw new UserDatabaseException("Could not check password against current policy.", e);
View Full Code Here


    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if(isCommiting()) {
            ActionErrors errors = new ActionErrors();       
            try {
                if (getOldPassphrase().length() == 0 && !resetPrivateKey) {
                    throw new FieldValidationException("noOldPassphrase");
                }
            } catch (FieldValidationException fve) {
                errors.add(Globals.ERROR_KEY, new ActionMessage("updatePrivateKeyPassphrase.error." + fve.getResourceKey()));
            } catch (Exception e) {
                errors.add(Globals.ERROR_KEY, new ActionMessage("updatePrivateKeyPassphrase.error.validateFailed", e.getMessage()));
View Full Code Here

    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        if(isCommiting()) {
            ActionErrors errors = new ActionErrors();       
            try {
                if (getPassphrase().length() == 0) {
                    throw new FieldValidationException("noPassphrase");
                }
                if(getNewKey()) {
                    if(!getPassphrase().equals(getConfirmPassphrase())) {       
                        throw new FieldValidationException("passphraseAndConfirmPassphraseDontMatch");
                    }
                }
            } catch (FieldValidationException fve) {
                errors.add(Globals.ERROR_KEY, new ActionMessage("promptForPrivateKeyPassphrase.error." + fve.getResourceKey()));
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.adito.core.FieldValidationException

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.