Package org.apache.openejb.core

Examples of org.apache.openejb.core.CoreDeploymentInfo


    public boolean isCallerAuthorized(Method method, InterfaceType typee) {
        ThreadContext threadContext = ThreadContext.getThreadContext();

        try {
            CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();

            // if security is not enabled we are autorized
            EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
            if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
                return true;
            }

            String ejbName = deploymentInfo.getEjbName();

            InterfaceType type = deploymentInfo.getInterfaceType(method.getDeclaringClass());

            String name = (type == null)? null: type.getSpecName();

            Permission permission = new EJBMethodPermission(ejbName, name, method);
View Full Code Here


        if (!(invocationHandler instanceof BaseEjbProxyHandler)) {
            return proxy;
        }

        BaseEjbProxyHandler ejbProxyHandler = (BaseEjbProxyHandler) invocationHandler;
        CoreDeploymentInfo deploymentInfo = ejbProxyHandler.getDeploymentInfo();
        String deploymentId = (String) deploymentInfo.getDeploymentID();
        try {
            RefGenerator refGenerator = AdapterWrapper.getRefGenerator(deploymentId);
            if (refGenerator == null) {
                throw new MARSHAL("Could not find RefGenerator for deployment id: " +deploymentId);
            }
            if (proxy instanceof EJBHome) {
                return refGenerator.genHomeReference();
            } else if (proxy instanceof EJBObject) {
                Object primaryKey = null;
                if (deploymentInfo.getComponentType() != BeanType.STATELESS) {
                    EJBObject ejbObject = (EJBObject) proxy;
                    primaryKey = ejbObject.getPrimaryKey();
                }
                return refGenerator.genObjectReference(primaryKey);
            } else {
View Full Code Here

    public boolean isCallerInRole(String role) {
        if (role == null) throw new IllegalArgumentException("Role must not be null");

        ThreadContext threadContext = ThreadContext.getThreadContext();

        CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();

        // if security is not enabled we are not in that role
        EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
        if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
            return false;
        }

        return ContextManager.isCallerInRole(deploymentInfo.getEjbName(), role);
    }
View Full Code Here

    }

    public Principal getCallerPrincipal() {
        // if security is not enabled, we don't have a principal
        ThreadContext threadContext = ThreadContext.getThreadContext();
        CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
        EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
        if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
            return null;
        }

        Subject callerSubject = ContextManager.getCurrentCaller();
View Full Code Here

        return deployment.get(deploymentInfo);
    }


    public void contextEntered(ThreadContext oldContext, ThreadContext newContext) {
        CoreDeploymentInfo deploymentInfo = newContext.getDeploymentInfo();
        if (deploymentInfo == null) return;

        EjbDeployment ejbDeployment = getEjbDeployment(deploymentInfo);

        if (ejbDeployment == null) return;
View Full Code Here

        newContext.set(GeronimoCallContext.class, geronimoCallContext);
    }

    public void contextExited(ThreadContext exitedContext, ThreadContext reenteredContext) {
        CoreDeploymentInfo deploymentInfo = exitedContext.getDeploymentInfo();
        if (deploymentInfo == null) return;

        EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
        if (ejbDeployment == null) return;

        // Geronimo call context is used to track old state that must be restored
        GeronimoCallContext geronimoCallContext = exitedContext.get(GeronimoCallContext.class);
        if (geronimoCallContext == null) return;
View Full Code Here

    public boolean isCallerAuthorized(Method method, InterfaceType typee) {
        ThreadContext threadContext = ThreadContext.getThreadContext();

        try {
            CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();

            // if security is not enabled we are autorized
            EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
            if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
                return true;
            }

            String ejbName = deploymentInfo.getEjbName();

            InterfaceType type = deploymentInfo.getInterfaceType(method.getDeclaringClass());

            String name = (type == null) ? null : type.getSpecName();

            Permission permission = new EJBMethodPermission(ejbName, name, method);
View Full Code Here

    public boolean isCallerInRole(String role) {
        if (role == null) throw new IllegalArgumentException("Role must not be null");

        ThreadContext threadContext = ThreadContext.getThreadContext();

        CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();

        // if security is not enabled we are not in that role
        EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
        if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
            return false;
        }

        String EJBName = deploymentInfo.getEjbName();
        if (EJBName == null) throw new IllegalArgumentException("EJBName must not be null");
        try {
            AccessControlContext context = ContextManager.getCurrentContext();
            context.checkPermission(new EJBRoleRefPermission(EJBName, role));
        } catch (AccessControlException e) {
View Full Code Here

    }

    public Principal getCallerPrincipal() {
        // if security is not enabled, we don't have a principal
        ThreadContext threadContext = ThreadContext.getThreadContext();
        CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
        EjbDeployment ejbDeployment = deploymentInfo.get(EjbDeployment.class);
        if (ejbDeployment == null || !ejbDeployment.isSecurityEnabled()) {
            return null;
        }

        Subject callerSubject = ContextManager.getCurrentCaller();
View Full Code Here

        SecurityService securityService = (SecurityService) mock(SecurityService.class);
        container = (ClusteredStatefulContainer) intercept(ClusteredStatefulContainer.class, new Object[] {"id",
                securityService});
        deploymentId = "deploymentId";
        deploymentInfo = new CoreDeploymentInfo(new DeploymentContext(deploymentId, null, null),
            SFSB.class,
            null,
            null,
            null,
            null,
View Full Code Here

TOP

Related Classes of org.apache.openejb.core.CoreDeploymentInfo

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.