Package org.apache.myfaces.extensions.cdi.core.api.security

Examples of org.apache.myfaces.extensions.cdi.core.api.security.AbstractAccessDecisionVoter


    public boolean hasAccess(final SecuredComponentData secureComponentData) {
        boolean result = secureComponentData.isCombined();
        boolean partialResult;
        Object[] contextParameters = getContextParameters(secureComponentData);
        for (String voter : secureComponentData.getVoters()) {
            AbstractAccessDecisionVoter bean = getBean(voter.trim());

            if (bean == null) {
                return false;
            }
            InvocationContext ic = new InvocationContextImpl(secureComponentData
                    .getTargetComponent(), contextParameters);
            Set<SecurityViolation> securityViolations = bean.checkPermission(ic);

            partialResult = securityViolations.isEmpty();
            if (secureComponentData.isNot()) {
                partialResult = !partialResult;
            }
View Full Code Here


        }
        return result;
    }

    private AbstractAccessDecisionVoter getBean(final String name) {
        AbstractAccessDecisionVoter result = null;
        try {
            result = CDIUtil.getContextualReferenceByName(beanManager, name, AbstractAccessDecisionVoter.class);
        } catch (NoSuchElementException e) {
            logger.warn("The AccessDecisionVoter with name " + name + " is not found.");
        }
View Full Code Here

    }

    private Set<SecurityViolation> performCustomChecks(CustomVoterCheck customCheck, InvocationContext invocationContext) {
        Set<SecurityViolation> result = new HashSet<SecurityViolation>();
        for ( Class<? extends AbstractAccessDecisionVoter> clsName :  customCheck.value()) {
            AbstractAccessDecisionVoter voter = CodiUtils.getContextualReferenceByClass(clsName);
            result.addAll(voter.checkPermission(invocationContext));
        }

        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.core.api.security.AbstractAccessDecisionVoter

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.