Package org.apache.syncope.types

Examples of org.apache.syncope.types.PasswordPolicySpec


        // set password
        int passwordHistorySize = 0;

        try {
            Policy policy = policyDAO.getGlobalPasswordPolicy();
            PasswordPolicySpec passwordPolicy = policy.getSpecification();
            passwordHistorySize = passwordPolicy.getHistoryLength();
        } catch (Exception ignore) {
            // ignore exceptions
        }

        if (userTO.getPassword() == null || userTO.getPassword().isEmpty()) {
View Full Code Here


        // password
        if (userMod.getPassword() != null) {
            int passwordHistorySize = 0;
            try {
                Policy policy = policyDAO.getGlobalPasswordPolicy();
                PasswordPolicySpec passwordPolicy = policy.getSpecification();
                passwordHistorySize = passwordPolicy.getHistoryLength();
            } catch (Exception ignore) {
                // ignore exceptions
            }

            user.setPassword(userMod.getPassword(), getCipherAlgoritm(), passwordHistorySize);
View Full Code Here

            case GLOBAL_PASSWORD:
            case PASSWORD:
                spec = ((PasswordPolicyTO) policyTO).getSpecification() != null
                        ? ((PasswordPolicyTO) policyTO).getSpecification()
                        : new PasswordPolicySpec();
                break;

            case GLOBAL_SYNC:
            case SYNC:
            default:
View Full Code Here

    }

    @Test
    public void createWithException() {
        PasswordPolicyTO policy = new PasswordPolicyTO(true);
        policy.setSpecification(new PasswordPolicySpec());
        policy.setDescription("global password policy");

        Throwable t = null;
        try {
            restTemplate.postForObject(BASE_URL + "policy/password/create", policy, PasswordPolicyTO.class);
View Full Code Here

        // read new password policy
        policy = restTemplate.getForObject(BASE_URL + "policy/read/{id}", PasswordPolicyTO.class, policy.getId());

        assertNotNull("find to update did not work", policy);

        PasswordPolicySpec policySpec = ((PasswordPolicyTO) policy).getSpecification();
        policySpec.setMaxLength(22);
        policy.setSpecification(policySpec);

        // update new password policy
        policy = restTemplate.postForObject(BASE_URL + "policy/password/update", policy, PasswordPolicyTO.class);
View Full Code Here

            case GLOBAL_PASSWORD:
            case PASSWORD:
                spec = ((PasswordPolicyTO) policyTO).getSpecification() != null
                        ? ((PasswordPolicyTO) policyTO).getSpecification()
                        : new PasswordPolicySpec();
                break;

            case GLOBAL_SYNC:
            case SYNC:
            default:
View Full Code Here

        // set password
        int passwordHistorySize = 0;

        try {
            Policy policy = policyDAO.getGlobalPasswordPolicy();
            PasswordPolicySpec passwordPolicy = policy.getSpecification();
            passwordHistorySize = passwordPolicy.getHistoryLength();
        } catch (Exception ignore) {
            // ignore exceptions
        }

        if (userTO.getPassword() == null || userTO.getPassword().isEmpty()) {
View Full Code Here

        // password
        if (userMod.getPassword() != null) {
            int passwordHistorySize = 0;
            try {
                Policy policy = policyDAO.getGlobalPasswordPolicy();
                PasswordPolicySpec passwordPolicy = policy.getSpecification();
                passwordHistorySize = passwordPolicy.getHistoryLength();
            } catch (Exception ignore) {
                // ignore exceptions
            }

            user.setPassword(userMod.getPassword(), getCipherAlgoritm(), passwordHistorySize);
View Full Code Here

            List<String> values;

            switch (policy.getType()) {
                case PASSWORD:
                case GLOBAL_PASSWORD:
                    final PasswordPolicySpec ppSpec = policy.getSpecification();
                    final PasswordPolicySpec evaluatedPPSpec = new PasswordPolicySpec();

                    BeanUtils.copyProperties(ppSpec, evaluatedPPSpec, new String[]{"schemasNotPermitted"});

                    for (String schema : ppSpec.getSchemasNotPermitted()) {
                        attribute = attributable.getAttribute(schema);
                        if (attribute != null) {
                            values = attribute.getValuesAsStrings();
                            if (values != null && !values.isEmpty()) {
                                evaluatedPPSpec.getWordsNotPermitted().add(values.get(0));
                            }
                        }
                    }

                    // Password history verification and update

                    if (!(attributable instanceof SyncopeUser)) {
                        LOG.error("Cannot check previous passwords. attributable is not a user object: {}",
                                attributable.getClass().getName());
                        result = (T) evaluatedPPSpec;
                        break;
                    }
                    SyncopeUser user = (SyncopeUser) attributable;
                    if (user.verifyPasswordHistory(user.getClearPassword(), ppSpec.getHistoryLength())) {
                        evaluatedPPSpec.getWordsNotPermitted().add(user.getClearPassword());
                    }
                    result = (T) evaluatedPPSpec;
                    break;
                case ACCOUNT:
                case GLOBAL_ACCOUNT:
View Full Code Here

        if (object.getClearPassword() != null) {
            try {
                int maxPPSpecHistory = 0;
                for (Policy policy : getPasswordPolicies(object)) {
                    // evaluate policy
                    final PasswordPolicySpec ppSpec = evaluator.evaluate(policy, object);
                    // enforce policy
                    ppEnforcer.enforce(ppSpec, policy.getType(), object.getClearPassword());

                    if (ppSpec.getHistoryLength() > maxPPSpecHistory) {
                        maxPPSpecHistory = ppSpec.getHistoryLength();
                    }
                }

                // update user's password history with encrypted password
                if (maxPPSpecHistory > 0 && object.getPassword() != null) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.types.PasswordPolicySpec

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.