User: negaton
Date: 01/10/27 07:34:17
Modified: src/main/org/jboss/ejb/plugins/jrmp/interfaces
StatefulHandleImpl.java
Log:
Fix for bug 474134. Security context wasn't being propagated during call to
getEJBObject(). (For Entity and Stateless beans the invocation is made through the
home proxy so this happens automatically). Added the current principal and credential
(as obtained from SecurityAssociation) to the method invocation.
Revision Changes Path
1.10 +14 -1
jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/StatefulHandleImpl.java
Index: StatefulHandleImpl.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jrmp/interfaces/StatefulHandleImpl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StatefulHandleImpl.java 2001/09/01 19:50:31 1.9
+++ StatefulHandleImpl.java 2001/10/27 14:34:17 1.10
@@ -15,6 +15,7 @@
import javax.ejb.EJBObject;
import javax.naming.InitialContext;
+import org.jboss.security.SecurityAssociation;
/**
* An EJB stateful session bean handle.
@@ -22,7 +23,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>.
* @author <a href="mailto:[EMAIL PROTECTED]>Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class StatefulHandleImpl
extends AbstractHandle
@@ -80,6 +81,14 @@
/**
* Handle implementation.
*
+ * This differs from Stateless and Entity handles which just invoke standard
methods
+ * (<tt>create</tt> and <tt>findByPrimaryKey</tt> respectively) on the Home
interface (proxy).
+ * There is no equivalent option for stateful SBs, so a direct invocation on
the container has to
+ * be made to locate the bean by its id (the stateful SB container provides an
implementation of
+ * <tt>getEJBObject</tt>).
+ *
+ * This means the security context has to be set here just as it would be in
the Proxy.
+ *
* @return <tt>EJBObject</tt> reference.
*
* @throws ServerException Could not get EJBObject.
@@ -117,6 +126,10 @@
// is the credential thread local? (don't think so... but...)
//rmi.setPrincipal( getPrincipal() );
// rmi.setCredential( getCredential() );
+
+ // LT: added next two lines as fix for bug 474134 (26/10/01). Not sure
which of the above comments are relevant...
+ rmi.setPrincipal(SecurityAssociation.getPrincipal());
+ rmi.setCredential(SecurityAssociation.getCredential());
// Invoke on the remote server, enforce marshalling
MarshalledObject mo = new MarshalledObject(rmi);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development