Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.MethodPermission$JAXB


        try {
            final XMLStreamReader filter = Sxc.prepareReader(inputStream);
            synchronized (Adapters.handlerChainsStringQNameAdapterAdapter) { // few threads on it so synchronized > lock
                Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(filter.getNamespaceContext());
                try {
                    return Sxc.unmarhsal(new HandlerChains$JAXB(), new XoXMLStreamReaderImpl(filter));
                } finally {
                    Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(null);
                }
            }
        } finally {
View Full Code Here


            IO.close(inputStream);
        }
    }

    public static void marshal(final HandlerChains handlerChains, final OutputStream outputStream) throws Exception {
        Sxc.marshal(new HandlerChains$JAXB(), handlerChains, new StreamResult(outputStream));
    }
View Full Code Here

* @version $Rev$ $Date$
*/
public class HandlerChainsXml {

    public static HandlerChains unmarshal(final InputStream inputStream) throws Exception {
        return Sxc.unmarshalJavaee(new HandlerChains$JAXB(), inputStream);
    }
View Full Code Here

        try {
            final XMLStreamReader filter = Sxc.prepareReader(inputStream);
            synchronized (Adapters.handlerChainsStringQNameAdapterAdapter) { // few threads on it so synchronized > lock
                Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(filter.getNamespaceContext());
                try {
                    return Sxc.unmarhsal(new HandlerChains$JAXB(), new XoXMLStreamReaderImpl(filter));
                } finally {
                    Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(null);
                }
            }
        } finally {
View Full Code Here

            IO.close(inputStream);
        }
    }

    public static void marshal(final HandlerChains handlerChains, final OutputStream outputStream) throws Exception {
        Sxc.marshal(new HandlerChains$JAXB(), handlerChains, new StreamResult(outputStream));
    }
View Full Code Here

* @version $Rev$ $Date$
*/
public class HandlerChainsXml {

    public static HandlerChains unmarshal(InputStream inputStream) throws Exception {
        return Sxc.unmarshalJavaee(new HandlerChains$JAXB(), inputStream);
    }
View Full Code Here

        try {
            final XMLStreamReader filter = Sxc.prepareReader(inputStream);
            synchronized (Adapters.handlerChainsStringQNameAdapterAdapter) { // few threads on it so synchronized > lock
                Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(filter.getNamespaceContext());
                try {
                    return Sxc.unmarhsal(new HandlerChains$JAXB(), new XoXMLStreamReaderImpl(filter));
                } finally {
                    Adapters.handlerChainsStringQNameAdapterAdapter.setNamespaceContext(null);
                }
            }
        } finally {
View Full Code Here

            IO.close(inputStream);
        }
    }

    public static void marshal(HandlerChains handlerChains, OutputStream outputStream) throws Exception {
        Sxc.marshal(new HandlerChains$JAXB(), handlerChains, new StreamResult(outputStream));
    }
View Full Code Here

                    if (rolesAllowed != null && permitAll != null){
                        ejbModule.getValidation().fail(ejbName, "permitAllAndRolesAllowedOnClass", clazz.getName());
                    }

                    if (rolesAllowed != null) {
                        MethodPermission methodPermission = new MethodPermission();
                        methodPermission.getRoleName().addAll(asList(rolesAllowed.value()));
                        methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*"));
                        assemblyDescriptor.getMethodPermission().add(methodPermission);

                        // Automatically add a role ref for any role listed in RolesAllowed
                        RemoteBean remoteBean = (RemoteBean) bean;
                        List<SecurityRoleRef> securityRoleRefs = remoteBean.getSecurityRoleRef();
                        for (String role : rolesAllowed.value()) {
                            securityRoleRefs.add(new SecurityRoleRef(role));
                        }
                    }

                    if (permitAll != null) {
                        MethodPermission methodPermission = new MethodPermission();
                        methodPermission.setUnchecked(true);
                        methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, clazz.getName(), "*"));
                        assemblyDescriptor.getMethodPermission().add(methodPermission);
                    }
                }

                RunAs runAs = clazz.getAnnotation(RunAs.class);
                if (runAs != null && bean.getSecurityIdentity() == null) {
                    SecurityIdentity securityIdentity = new SecurityIdentity();
                    securityIdentity.setRunAs(runAs.value());
                    bean.setSecurityIdentity(securityIdentity);
                }

                DeclareRoles declareRoles = clazz.getAnnotation(DeclareRoles.class);
                if (declareRoles != null && bean instanceof RemoteBean){
                    RemoteBean remoteBean = (RemoteBean) bean;
                    List<SecurityRoleRef> securityRoleRefs = remoteBean.getSecurityRoleRef();
                    for (String role : declareRoles.value()) {
                        securityRoleRefs.add(new SecurityRoleRef(role));
                    }
                }
            }

            List<Method> seen = new ArrayList<Method>();

            for (Method method : classFinder.findAnnotatedMethods(RolesAllowed.class)) {
                checkConflictingSecurityAnnotations(method, ejbName, ejbModule, seen);
                RolesAllowed rolesAllowed = method.getAnnotation(RolesAllowed.class);
                MethodPermission methodPermission = new MethodPermission();
                methodPermission.getRoleName().addAll(asList(rolesAllowed.value()));
                methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, method));
                assemblyDescriptor.getMethodPermission().add(methodPermission);

                // Automatically add a role ref for any role listed in RolesAllowed
                RemoteBean remoteBean = (RemoteBean) bean;
                List<SecurityRoleRef> securityRoleRefs = remoteBean.getSecurityRoleRef();
                for (String role : rolesAllowed.value()) {
                    securityRoleRefs.add(new SecurityRoleRef(role));
                }
            }

            for (Method method : classFinder.findAnnotatedMethods(PermitAll.class)) {
                checkConflictingSecurityAnnotations(method, ejbName, ejbModule, seen);
                MethodPermission methodPermission = new MethodPermission();
                methodPermission.setUnchecked(true);
                methodPermission.getMethod().add(new org.apache.openejb.jee.Method(ejbName, method));
                assemblyDescriptor.getMethodPermission().add(methodPermission);
            }

            for (Method method : classFinder.findAnnotatedMethods(DenyAll.class)) {
                checkConflictingSecurityAnnotations(method, ejbName, ejbModule, seen);
View Full Code Here

        securityService.login("foo", "Jazz", "Rock", "Reggae", "HipHop");

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatefulBean(Color.class));
        List<MethodPermission> permissions = ejbJar.getAssemblyDescriptor().getMethodPermission();
        permissions.add(new MethodPermission("*", "Color", "*", "Foo"));
        permissions.add(new MethodPermission("*", "Color", "create").setUnchecked());
        permissions.add(new MethodPermission("*", "Color", "ejbCreate").setUnchecked());

        EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
        assembler.createApplication(ejbJarInfo);

        InitialContext context = new InitialContext();
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.MethodPermission$JAXB

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.