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

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


    public Object execute(InvocationContext invocationContext) throws Exception
    {
        AccessDecisionVoterContext voterContext =
                CodiUtils.getContextualReferenceByClass(beanManager, AccessDecisionVoterContext.class, true);

        Secured secured = null;

        List<Annotation> annotatedTypeMetadata = extractMetadata(invocationContext);

        for (Annotation annotation : annotatedTypeMetadata)
        {
            if(Secured.class.isAssignableFrom(annotation.annotationType()))
            {
                secured = (Secured)annotation;
            }
            else if(voterContext instanceof EditableAccessDecisionVoterContext)
            {
                ((EditableAccessDecisionVoterContext)voterContext)
                        .addMetaData(annotation.annotationType().getName(), annotation);
            }
        }

        if(secured != null)
        {
            Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();

            invokeVoters(invocationContext, this.beanManager, voterContext,
                    Arrays.asList(voterClasses), secured.errorView());
        }

        return invocationContext.proceed();
    }
View Full Code Here


    }

    @AroundInvoke
    public Object filterDeniedInvocations(InvocationContext invocationContext) throws Exception
    {
        Secured secured = getSecuredAnnotation(invocationContext);

        Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();

        invokeVoters(invocationContext, this.beanManager, voterClasses, secured.errorView());

        return invocationContext.proceed();
    }
View Full Code Here

    }

    //TODO refactor it to a generic impl. and move it to an util class
    private Secured getSecuredAnnotation(InvocationContext invocationContext)
    {
        Secured secured;
        Method method = invocationContext.getMethod();

        if(method.isAnnotationPresent(Secured.class))
        {
            secured = method.getAnnotation(Secured.class);
View Full Code Here

        List<Annotation> viewMetaDataList = new ArrayList<Annotation>();
        List<Class<? extends Annotation>> foundAndBlockedMetaDataTypes = new ArrayList<Class<? extends Annotation>>();

        //TODO
        Page pageAnnotation;
        Secured securedAnnotation;
        while(!Object.class.getName().equals(currentClass.getName()))
        {
            //security
            if(currentClass.isAnnotationPresent(Secured.class))
            {
                securedAnnotation = currentClass.getAnnotation(Secured.class);
                Collections.addAll(foundVoters, securedAnnotation.value());

                if(errorView == null &&
                        !DefaultErrorView.class.getName().equals(securedAnnotation.errorView().getName()))
                {
                    errorView = securedAnnotation.errorView();
                }
            }

            //meta-data
            viewMetaDataList.addAll(extractViewMetaData(currentClass, foundAndBlockedMetaDataTypes));
View Full Code Here

    }

    @AroundInvoke
    public Object filterDeniedInvocations(InvocationContext invocationContext) throws Exception
    {
        Secured secured = getSecuredAnnotation(invocationContext);

        Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();

        invokeVoters(invocationContext, this.beanManager, Arrays.asList(voterClasses), secured.errorView());

        return invocationContext.proceed();
    }
View Full Code Here

    }

    //TODO refactor it to a generic impl. and move it to an util class
    private Secured getSecuredAnnotation(InvocationContext invocationContext)
    {
        Secured secured;
        Method method = invocationContext.getMethod();

        if(method.isAnnotationPresent(Secured.class))
        {
            secured = method.getAnnotation(Secured.class);
View Full Code Here

        String defaultPageName = DefaultViewConfigDefinitionEntry.DEFAULT_PAGE_NAME;
        String rootPath = DefaultViewConfigDefinitionEntry.ROOT_PATH;

        String currentBasePath;
        Page pageAnnotation;
        Secured securedAnnotation;

        Class<?> currentClass = viewDefinitionClass;
        while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))
        {
            //security
            if (currentClass.isAnnotationPresent(Secured.class))
            {
                securedAnnotation = currentClass.getAnnotation(Secured.class);
                scannedViewConfig.addAccessDecisionVoters(securedAnnotation.value());

                if (scannedViewConfig.getErrorView() == null &&
                        !DefaultErrorView.class.getName().equals(securedAnnotation.errorView().getName()))
                {
                    scannedViewConfig.setErrorView(securedAnnotation.errorView());
                }
            }

            //meta-data
            scannedViewConfig.addMetaData(
View Full Code Here

        String defaultPageName = ExtractedViewConfigDefinitionEntry.DEFAULT_PAGE_NAME;
        String rootPath = ExtractedViewConfigDefinitionEntry.ROOT_PATH;

        String currentBasePath;
        Page pageAnnotation;
        Secured securedAnnotation;

        Class<?> currentClass = viewDefinitionClass;
        while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))
        {
            //security
            if (currentClass.isAnnotationPresent(Secured.class))
            {
                securedAnnotation = currentClass.getAnnotation(Secured.class);
                scannedViewConfig.addAccessDecisionVoters(securedAnnotation.value());

                if (scannedViewConfig.getErrorView() == null &&
                        !DefaultErrorView.class.getName().equals(securedAnnotation.errorView().getName()))
                {
                    scannedViewConfig.setErrorView(securedAnnotation.errorView());
                }
            }

            //meta-data
            scannedViewConfig.addMetaData(
View Full Code Here

    @Inject
    private BeanManager beanManager;

    public Object execute(InvocationContext invocationContext) throws Exception
    {
        Secured secured = getSecuredAnnotation(invocationContext);

        Class<? extends AccessDecisionVoter>[] voterClasses = secured.value();

        invokeVoters(invocationContext, this.beanManager, Arrays.asList(voterClasses), secured.errorView());

        return invocationContext.proceed();
    }
View Full Code Here

    }

    //TODO refactor it to a generic impl. and move it to an util class
    private Secured getSecuredAnnotation(InvocationContext invocationContext)
    {
        Secured secured;
        Method method = invocationContext.getMethod();

        if(method.isAnnotationPresent(Secured.class))
        {
            secured = method.getAnnotation(Secured.class);
View Full Code Here

TOP

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

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.