/** * This method is used by Message Driven Bean Container to remove * the run-as identity information that was set up using the * preSetRunAsIdentity method */ public void postInvoke(ComponentInvocation inv) { if (runAs != null && inv.isPreInvokeDone()) { final ComponentInvocation finv = inv; AppservAccessController.doPrivileged(new PrivilegedAction() { public Object run() { SecurityContext.setCurrent( (SecurityContext) finv.getOldSecurityContext()); return null; } }); } }
/** * This method is used by Message Driven Bean Container to remove * the run-as identity information that was set up using the * preSetRunAsIdentity method */ public void postInvoke(ComponentInvocation inv) { if (runAs != null && inv.isPreInvokeDone()) { final ComponentInvocation finv = inv; AppservAccessController.doPrivileged(new PrivilegedAction() { public Object run() { SecurityContext.setCurrent( (SecurityContext) finv.getOldSecurityContext()); return null; } }); } }
public void beforePreInvoke(ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv) throws InvocationException { if (invType == ComponentInvocationType.EJB_INVOCATION) { try { if (!newInv.isPreInvokeDone()) { ((EjbInvocation) newInv).getEjbSecurityManager().preInvoke(newInv); } } catch (Exception ex) { _logger.log(Level.SEVERE, "ejb.security_preinvoke_exception",ex); throw new InvocationException(ex); } } }
public void beforePreInvoke(ComponentInvocationType invType, ComponentInvocation prevInv, ComponentInvocation newInv) throws InvocationException { if (invType == ComponentInvocationType.EJB_INVOCATION) { assert (newInv instanceof EjbInvocation); try { if (!newInv.isPreInvokeDone()) { ((EjbInvocation) newInv).getEjbSecurityManager().preInvoke(newInv); } } catch (Exception ex) { _logger.log(Level.SEVERE, "ejb.security_preinvoke_exception",ex); throw new InvocationException(ex); } } }
/** * This method is used by MDB Container - Invocation Manager to setup * the run-as identity information. It has to be coupled with * the postSetRunAsIdentity method. * This method is called for EJB/MDB Containers */ public void preInvoke(ComponentInvocation inv) { //Optimization to avoid the expensive call if(runAs == null) { inv.setPreInvokeDone(true); return; } boolean isWebService = false; if (inv instanceof EjbInvocation) { isWebService = ((EjbInvocation) inv).isWebService; } // if it is not a webservice or successful authorization // and preInvoke is not call before if ((!isWebService || (inv.getAuth() != null && inv.getAuth().booleanValue())) && !inv.isPreInvokeDone()) { inv.setOldSecurityContext(SecurityContext.getCurrent()); loginForRunAs(); inv.setPreInvokeDone(true); } }
/** * This method is used by MDB Container - Invocation Manager to setup * the run-as identity information. It has to be coupled with * the postSetRunAsIdentity method. * This method is called for EJB/MDB Containers */ public void preInvoke(ComponentInvocation inv) { //Optimization to avoid the expensive call if(runAs == null) { inv.setPreInvokeDone(true); return; } boolean isWebService = false; if (inv instanceof EjbInvocation) { isWebService = ((EjbInvocation) inv).isWebService; } // if it is not a webservice or successful authorization // and preInvoke is not call before if ((!isWebService || (inv.getAuth() != null && inv.getAuth().booleanValue())) && !inv.isPreInvokeDone()) { if (runAs != null) { inv.setOldSecurityContext(SecurityContext.getCurrent()); loginForRunAs(); } inv.setPreInvokeDone(true); } }