Package org.apache.syncope.core.persistence.beans

Examples of org.apache.syncope.core.persistence.beans.PasswordPolicy


                if (!(policyTO instanceof PasswordPolicyTO)) {
                    throw new ClassCastException("Expected " + PasswordPolicyTO.class.getName()
                            + ", found " + policyTO.getClass().getName());
                }
                if (policy == null) {
                    policy = (T) new PasswordPolicy(isGlobal);
                }
                policy.setSpecification(((PasswordPolicyTO) policyTO).getSpecification());
                break;

            case GLOBAL_ACCOUNT:
View Full Code Here


    private void setPassword(final SyncopeUser user, final String password,
            final SyncopeClientCompositeErrorException scce) {

        int passwordHistorySize = 0;
        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
        if (policy != null && policy.getSpecification() != null) {
            passwordHistorySize = policy.<PasswordPolicySpec>getSpecification().getHistoryLength();
        }

        try {
            user.setPassword(password, getPredefinedCipherAlgoritm(), passwordHistorySize);
        } catch (NotFoundException e) {
View Full Code Here

            case PASSWORD:
                if (!(policyTO instanceof PasswordPolicyTO)) {
                    throw new ClassCastException("policyTO is expected to be typed PasswordPolicyTO: " + policyTO.getClass().getName());
                }
                if (policy == null) {
                    policy = (T) new PasswordPolicy(isGlobal);
                }
                policy.setSpecification(((PasswordPolicyTO) policyTO).getSpecification());
                break;

            case GLOBAL_ACCOUNT:
View Full Code Here

        switch (object.getType()) {
            case GLOBAL_PASSWORD:

                // just one GLOBAL_PASSWORD policy
                final PasswordPolicy passwordPolicy = policyDAO.getGlobalPasswordPolicy();

                if (passwordPolicy != null && !passwordPolicy.getId().equals(object.getId())) {

                    context.buildConstraintViolationWithTemplate("Password policy already exists").addNode(
                            EntityViolationType.InvalidPasswordPolicy.name()).addConstraintViolation();

                    return false;
View Full Code Here

    private List<PasswordPolicy> getPasswordPolicies(final SyncopeUser user) {
        final List<PasswordPolicy> policies = new ArrayList<PasswordPolicy>();

        // Add global policy
        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
        if (policy != null) {
            policies.add(policy);
        }

        // add resource policies
View Full Code Here

    @RequestMapping(method = RequestMethod.GET, value = "/password/global/read")
    public PasswordPolicyTO getGlobalPasswordPolicy() throws NotFoundException {

        LOG.debug("Reading global password policy");

        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
        if (policy == null) {
            throw new NotFoundException("No password policy found");
        }

        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
                "Successfully read global password policy: " + policy.getId());

        return (PasswordPolicyTO) binder.getPolicyTO(policy);
    }
View Full Code Here

    private PolicyDAO policyDAO;

    public void createWithPasswordPolicy() {
        final String resourceName = "resourceWithPasswordPolicy";

        PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
        ExternalResource resource = new ExternalResource();
        resource.setName(resourceName);
        resource.setPasswordPolicy(policy);

        ExternalResource actual = resourceDAO.save(resource);
View Full Code Here

    private PolicyDAO policyDAO;

    public void createWithPasswordPolicy() {
        final String ROLE_NAME = "roleWithPasswordPolicy";

        PasswordPolicy policy = (PasswordPolicy) policyDAO.find(4L);
        SyncopeRole role = new SyncopeRole();
        role.setName(ROLE_NAME);
        role.setPasswordPolicy(policy);

        SyncopeRole actual = roleDAO.save(role);
View Full Code Here

    public PasswordPolicyTO create(final HttpServletResponse response, @RequestBody final PasswordPolicyTO policyTO)
            throws SyncopeClientCompositeErrorException {

        LOG.debug("Creating policy " + policyTO);

        final PasswordPolicy policy = binder.getPolicy(null, policyTO);

        auditManager.audit(Category.policy, PolicySubCategory.create, Result.success,
                "Successfully created password policy: " + policy.getId());

        return binder.getPolicyTO(policyDAO.save(policy));
    }
View Full Code Here

        assertFalse(policies.isEmpty());
    }

    @Test
    public void findGlobalPasswordPolicy() {
        PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
        assertNotNull("findById did not work", policy);

        assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());

        assertEquals("invalid policy values", 8, ((PasswordPolicySpec) policy.getSpecification()).getMinLength());
    }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.PasswordPolicy

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.