[jboss-cvs] JBossAS SVN: r57535 - branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 10 10:45:42 EDT 2006


Author: anil.saldhana at jboss.com
Date: 2006-10-10 10:45:41 -0400 (Tue, 10 Oct 2006)
New Revision: 57535

Modified:
   branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/RunAsSecurityInterceptorFactory.java
Log:
EJBTHREE-734:Take care of Run-As Principal specified in jboss.xml when the RunAs annotation is present while ejb-jar.xml is absent

Modified: branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/RunAsSecurityInterceptorFactory.java
===================================================================
--- branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/RunAsSecurityInterceptorFactory.java	2006-10-10 14:44:34 UTC (rev 57534)
+++ branches/JEE5_TCK/ejb3/src/main/org/jboss/ejb3/security/RunAsSecurityInterceptorFactory.java	2006-10-10 14:45:41 UTC (rev 57535)
@@ -34,6 +34,7 @@
 import org.jboss.security.RealmMapping;
 import org.jboss.security.RunAsIdentity; 
 import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.metamodel.AssemblyDescriptor;
 import org.jboss.ejb3.tx.NullInterceptor;
 import org.jboss.annotation.security.RunAsPrincipal;
 
@@ -59,9 +60,17 @@
       }
       RunAsPrincipal rap = (RunAsPrincipal) container.resolveAnnotation(RunAsPrincipal.class);
       String runAsPrincipal = null;
-      if (rap != null) runAsPrincipal = rap.value();
+      if (rap != null) 
+         runAsPrincipal = rap.value();
+      else
+      {
+         //Check if jboss.xml has it  
+         runAsPrincipal = container.getXml().getSecurityIdentity().getRunAsPrincipal();
+      }
 
-      HashSet extraRoles = new HashSet(); // todo get extra mapped roles.
+      HashSet extraRoles = new HashSet();  
+      AssemblyDescriptor ad = container.getAssemblyDescriptor();
+      extraRoles.addAll(ad.getSecurityRolesGivenPrincipal(runAsPrincipal));
 
       return new RunAsIdentity(runAs.value(), runAsPrincipal, extraRoles);
    }




More information about the jboss-cvs-commits mailing list