[jboss-cvs] JBossAS SVN: r69133 - in trunk/server/src/main/org/jboss/ejb: plugins and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 18 17:48:24 EST 2008
Author: anil.saldhana at jboss.com
Date: 2008-01-18 17:48:23 -0500 (Fri, 18 Jan 2008)
New Revision: 69133
Modified:
trunk/server/src/main/org/jboss/ejb/EnterpriseContext.java
trunk/server/src/main/org/jboss/ejb/SecurityActions.java
trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java
trunk/server/src/main/org/jboss/ejb/plugins/StatelessSessionInstanceInterceptor.java
Log:
remove the SecurityContext property from EnterpriseContext
Modified: trunk/server/src/main/org/jboss/ejb/EnterpriseContext.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EnterpriseContext.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/EnterpriseContext.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -111,9 +111,6 @@
/** The principal for the bean associated with the call */
private Principal beanPrincipal;
-
- /** SecurityContext associated with the invocation */
- private SecurityContext securityContext;
/** Only StatelessSession beans have no Id, stateful and entity do */
Object id;
@@ -217,11 +214,6 @@
this.beanPrincipal = getCallerPrincipal();
}
- public void setSecurityContext(SecurityContext securityContext)
- {
- this.securityContext = securityContext;
- }
-
public void lock()
{
locked++;
@@ -368,7 +360,7 @@
if( beanPrincipal == null )
{
RealmMapping rm = con.getRealmMapping();
- EJBAuthorizationHelper helper = new EJBAuthorizationHelper(securityContext);
+ EJBAuthorizationHelper helper = new EJBAuthorizationHelper(SecurityActions.getSecurityContext());
Principal caller = helper.getCallerPrincipal(rm);
if( caller == null )
{
@@ -526,7 +518,7 @@
log.trace("PolicyContextException in getting caller subject:",pe);
}
- EJBAuthorizationHelper helper = new EJBAuthorizationHelper(securityContext);
+ EJBAuthorizationHelper helper = new EJBAuthorizationHelper(SecurityActions.getSecurityContext());
String ejbName = getContainer().getBeanMetaData().getEjbName();
return helper.isCallerInRole(roleName, ejbName, principal, securityRoleRefs);
}
Modified: trunk/server/src/main/org/jboss/ejb/SecurityActions.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/SecurityActions.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/SecurityActions.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -39,6 +39,7 @@
import org.jboss.mx.util.MBeanProxy;
import org.jboss.security.SecurityContext;
+import org.jboss.security.plugins.SecurityContextAssociation;
/** A collection of privileged actions for this package
*
@@ -392,4 +393,15 @@
return PolicyContextActions.PRIVILEGED.getContextSubject();
}
}
+
+ static SecurityContext getSecurityContext()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<SecurityContext>()
+ {
+ public SecurityContext run()
+ {
+ return SecurityContextAssociation.getSecurityContext();
+ }
+ });
+ }
}
Modified: trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -21,27 +21,28 @@
*/
package org.jboss.ejb.plugins;
+import java.lang.reflect.Method;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.NoSuchObjectLocalException;
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
+import javax.transaction.Transaction;
+
+import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.ejb.BeanLock;
import org.jboss.ejb.Container;
import org.jboss.ejb.EntityContainer;
import org.jboss.ejb.EntityEnterpriseContext;
+import org.jboss.ejb.GlobalTxEntityMap;
import org.jboss.ejb.InstanceCache;
-import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.ejb.InstancePool;
-import org.jboss.ejb.GlobalTxEntityMap;
import org.jboss.invocation.Invocation;
import org.jboss.invocation.InvocationType;
import org.jboss.util.NestedRuntimeException;
-import javax.ejb.EJBException;
-import javax.ejb.NoSuchObjectLocalException;
-import javax.ejb.TimedObject;
-import javax.ejb.Timer;
-import javax.transaction.Transaction;
-import java.lang.reflect.Method;
-import java.rmi.NoSuchObjectException;
-import java.rmi.RemoteException;
-
/**
* The instance interceptors role is to acquire a context representing the
* target object from the cache.
@@ -121,7 +122,6 @@
// Give it the transaction
ctx.setTransaction(mi.getTransaction());
- ctx.setSecurityContext(mi.getSecurityContext());
// Set the current security information
ctx.setPrincipal(mi.getPrincipal());
@@ -259,7 +259,6 @@
}
}
- ctx.setSecurityContext(mi.getSecurityContext());
// Set the current security information
ctx.setPrincipal(mi.getPrincipal());
// Set the JACC EnterpriseBean PolicyContextHandler data
Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -21,13 +21,28 @@
*/
package org.jboss.ejb.plugins;
+import java.lang.reflect.Method;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBObject;
+import javax.ejb.Handle;
+import javax.ejb.NoSuchObjectLocalException;
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+
+import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.ejb.BeanLock;
import org.jboss.ejb.Container;
import org.jboss.ejb.EnterpriseContext;
import org.jboss.ejb.InstanceCache;
import org.jboss.ejb.InstancePool;
import org.jboss.ejb.StatefulSessionContainer;
-import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.invocation.Invocation;
import org.jboss.invocation.InvocationType;
import org.jboss.logging.Logger;
@@ -35,20 +50,6 @@
import org.jboss.security.AuthenticationManager;
import org.jboss.security.SecurityConstants;
-import javax.ejb.EJBException;
-import javax.ejb.EJBObject;
-import javax.ejb.Handle;
-import javax.ejb.NoSuchObjectLocalException;
-import javax.ejb.TimedObject;
-import javax.ejb.Timer;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import java.lang.reflect.Method;
-import java.rmi.NoSuchObjectException;
-import java.rmi.RemoteException;
-
/**
* This container acquires the given instance.
*
Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -23,7 +23,6 @@
import java.lang.reflect.Method;
-import javax.ejb.EJBObject;
import javax.ejb.Handle;
import org.jboss.ejb.Container;
@@ -75,9 +74,7 @@
EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext();
if(ctx == null)
throw new IllegalStateException("EJBContext is null");
-
- ctx.setSecurityContext(mi.getSecurityContext());
-
+
//Set the current security information
ctx.setPrincipal(mi.getPrincipal());
@@ -103,7 +100,6 @@
if(ctx == null)
throw new IllegalStateException("EJBContext is null");
- ctx.setSecurityContext(mi.getSecurityContext());
//Set the current security information
ctx.setPrincipal(mi.getPrincipal());
Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatelessSessionInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatelessSessionInstanceInterceptor.java 2008-01-18 22:47:27 UTC (rev 69132)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatelessSessionInstanceInterceptor.java 2008-01-18 22:48:23 UTC (rev 69133)
@@ -21,23 +21,23 @@
*/
package org.jboss.ejb.plugins;
-import java.rmi.RemoteException;
import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import javax.ejb.EJBException;
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
+
+import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.ejb.Container;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.invocation.InvocationType;
import org.jboss.ejb.EnterpriseContext;
-import org.jboss.ejb.StatelessSessionContainer;
import org.jboss.ejb.InstancePool;
-import org.jboss.ejb.AllowedOperationsAssociation;
+import org.jboss.ejb.StatelessSessionContainer;
import org.jboss.ejb.StatelessSessionEnterpriseContext;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.invocation.InvocationType;
-import javax.ejb.EJBException;
-import javax.ejb.TimedObject;
-import javax.ejb.Timer;
-
/**
* This container acquires the given instance. This must be used after
* the EnvironmentInterceptor, since acquiring instances requires a proper
@@ -134,7 +134,6 @@
}
- ctx.setSecurityContext(mi.getSecurityContext());
// Set the current security information
ctx.setPrincipal(mi.getPrincipal());
// Set the JACC EnterpriseBean PolicyContextHandler data
More information about the jboss-cvs-commits
mailing list