Examples of SecurityService


Examples of org.apache.openejb.spi.SecurityService

                        logger.debug("startup.debugEntry", entry);
                    }
                }
            }

            SecurityService securityService = assembler.getSecurityService();
            if (securityService == null) {
                String msg = messages.message("startup.assemblerReturnedNullSecurityService");
                logger.fatal(msg);
                throw new OpenEJBException(msg);
            } else {
                logger.debug("startup.securityService", securityService.getClass().getName());
            }
            system.setComponent(SecurityService.class, securityService);

            TransactionManager transactionManager = assembler.getTransactionManager();
            if (transactionManager == null) {
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        ThreadContext callContext = ThreadContext.getThreadContext();
        Object localClientIdentity = ClientSecurity.getIdentity();
        try {
            if (callContext == null && localClientIdentity != null) {
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                securityService.associate(localClientIdentity);
            }
            if (strategy == CLASSLOADER_COPY) {

                IntraVmCopyMonitor.pre(strategy);
                ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(getBeanContext().getClassLoader());
                try {
                    args = copyArgs(args);
                    method = copyMethod(method);
                    interfce = copyObj(interfce);
                } finally {
                    Thread.currentThread().setContextClassLoader(oldClassLoader);
                    IntraVmCopyMonitor.post();
                }

            } else if (strategy == COPY && args != null && args.length > 0) {

                IntraVmCopyMonitor.pre(strategy);
                try {
                    args = copyArgs(args);
                } finally {
                    IntraVmCopyMonitor.post();
                }
            }
            IntraVmCopyMonitor.State oldStrategy =  strategy;
            if (getBeanContext().isAsynchronous(method) || getBeanContext().getComponentType().equals(BeanType.MANAGED)){
                strategy = IntraVmCopyMonitor.State.NONE;
            }
  
            try {

                Object returnValue = _invoke(proxy, interfce, method, args);
                return copy(strategy, returnValue);
            } catch (Throwable throwable) {
                throwable = copy(strategy, throwable);
                throw convertException(throwable, method, interfce);
            } finally {
                strategy = oldStrategy;
            }
        } finally {
           
            if (callContext == null && localClientIdentity != null) {
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                securityService.disassociate();
            }
        }
    }
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        String realmName = (String) properties.get("openejb.authentication.realmName");

        if (user != null && pass != null){
            try {
                logger.info("Logging in");
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                if (realmName == null) {
                    clientIdentity = securityService.login(user, pass);
                } else {
                    clientIdentity = securityService.login(realmName, user, pass);
                }
                ClientSecurity.setIdentity(clientIdentity);
            } catch (LoginException e) {
                throw (AuthenticationException) new AuthenticationException("User could not be authenticated: "+user).initCause(e);
            }
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        }
    }

    private void logout() {
        try {
            SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
            if (clientIdentity != null) {
                logger.info("Logging out");
                securityService.logout(clientIdentity);
                ClientSecurity.setIdentity(null);
            }
        } catch (LoginException e) {
            throw new OpenEJBRuntimeException("User could not be logged out.", e);
        }
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        assertSame(springTM, initialContext.lookup("openejb/TransactionManager"));

        //
        // SecurityService
        //
        SecurityService springSecurityService = (SecurityService) context.getBean("sec");
        assertNotNull("springSecurityService is null", springSecurityService);
        assertTrue("springSecurityService should be an instance of MockSecurityService", springSecurityService instanceof MockSecurityService);

        SecurityService systemSecurityService = SystemInstance.get().getComponent(SecurityService.class);
        assertNotNull("systemSecurityService is null", systemSecurityService);
        assertSame(springSecurityService, systemSecurityService);

        assertSame(springSecurityService, initialContext.lookup("openejb/SecurityService"));
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        ThreadContext callContext = ThreadContext.getThreadContext();
        Object localClientIdentity = ClientSecurity.getIdentity();
        try {
            if (callContext == null && localClientIdentity != null) {
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                securityService.associate(localClientIdentity);
            }
            if (strategy == CLASSLOADER_COPY) {

                IntraVmCopyMonitor.pre(strategy);
                ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(getDeploymentInfo().getClassLoader());
                try {
                    args = copyArgs(args);
                    method = copyMethod(method);
                    interfce = copyObj(interfce);
                } finally {
                    Thread.currentThread().setContextClassLoader(oldClassLoader);
                    IntraVmCopyMonitor.post();
                }

            } else if (strategy == COPY && args != null && args.length > 0) {

                IntraVmCopyMonitor.pre(strategy);
                try {
                    args = copyArgs(args);
                } finally {
                    IntraVmCopyMonitor.post();
                }
            }

            try {

                Object returnValue = _invoke(proxy, interfce, method, args);

                return copy(strategy, returnValue);
            } catch (Throwable throwable) {
                throwable = copy(strategy, throwable);
                throw convertException(throwable, method, interfce);
            }
        } finally {
            if (callContext == null && localClientIdentity != null) {
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                securityService.disassociate();
            }
        }
    }
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        String pass = (String) env.get(Context.SECURITY_CREDENTIALS);
        String realmName = (String) env.get("openejb.authentication.realmName");

        if (user != null && pass != null){
            try {
                SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
                Object identity = null;
                if (realmName == null) {
                    identity = securityService.login(user, pass);
                } else {
                    identity = securityService.login(realmName, user, pass);
                }
                securityService.associate(identity);
            } catch (LoginException e) {
                throw (AuthenticationException) new AuthenticationException("User could not be authenticated: "+user).initCause(e);
            }
        }
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        transactionServiceInfo.id = "Default Transaction Manager";
        transactionServiceInfo.service = "TransactionManager";
        assembler.createTransactionManager(transactionServiceInfo);

        // install security service
        SecurityService securityService = new GeronimoSecurityService();
        SecurityServiceInfo securityServiceInfo = new SecurityServiceInfo();
        PassthroughFactory.add(securityServiceInfo, securityService);
        securityServiceInfo.id = "Default Security Service";
        securityServiceInfo.service = "SecurityService";
        assembler.createSecurityService(securityServiceInfo);
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

        transactionServiceInfo.id = "Default Transaction Manager";
        transactionServiceInfo.serviceType = "TransactionManager";
        assembler.createTransactionManager(transactionServiceInfo);

        // install security service
        SecurityService securityService = new GeronimoSecurityService();
        SecurityServiceInfo securityServiceInfo = new SecurityServiceInfo();
        PassthroughFactory.add(securityServiceInfo, securityService);
        securityServiceInfo.id = "Default Security Service";
        securityServiceInfo.serviceType = "SecurityService";
        assembler.createSecurityService(securityServiceInfo);
View Full Code Here

Examples of org.apache.openejb.spi.SecurityService

            final String securityRealm = req.getRealm();
            final String username = req.getUsername();
            final String password = req.getCredentials();

            final SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
            final Object token = securityService.login(securityRealm, username, password);

            final ClientMetaData client = new ClientMetaData();
            client.setMetaData(metaData);
            client.setClientIdentity(token);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.