[jboss-cvs] JBossAS SVN: r64853 - branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 24 12:16:31 EDT 2007


Author: kabir.khan at jboss.com
Date: 2007-08-24 12:16:30 -0400 (Fri, 24 Aug 2007)
New Revision: 64853

Modified:
   branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/RunAsSecurityInterceptor.java
   branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/SecurityClassMetaDataLoader.java
Log:
[JBAOP-193] SecurityClassMetaDataLoader.bind() should create a RunAsIdentity instead of a SimplePrincipal. RunAsInterceptor should check the class annotation if no @RunAs is found at joinpoint level

Modified: branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/RunAsSecurityInterceptor.java
===================================================================
--- branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/RunAsSecurityInterceptor.java	2007-08-24 15:46:42 UTC (rev 64852)
+++ branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/RunAsSecurityInterceptor.java	2007-08-24 16:16:30 UTC (rev 64853)
@@ -59,6 +59,10 @@
    protected RunAsIdentity getAnnotationRunAsIdentity(Invocation invocation)
    {
       RunAs runAs = (RunAs) invocation.resolveAnnotation(RunAs.class);
+      if (runAs == null)
+      {
+         runAs = (RunAs)invocation.resolveClassAnnotation(RunAs.class);
+      }
       if (runAs == null) return null;
       RunAsIdentity runAsRole = new RunAsIdentity(runAs.value(), null);
       return runAsRole;

Modified: branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/SecurityClassMetaDataLoader.java
===================================================================
--- branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/SecurityClassMetaDataLoader.java	2007-08-24 15:46:42 UTC (rev 64852)
+++ branches/Branch_4_2/aspects/src/main/org/jboss/aspects/security/SecurityClassMetaDataLoader.java	2007-08-24 16:16:30 UTC (rev 64853)
@@ -31,6 +31,7 @@
 import org.jboss.aop.util.XmlHelper;
 import org.jboss.security.AnybodyPrincipal;
 import org.jboss.security.NobodyPrincipal;
+import org.jboss.security.RunAsIdentity;
 import org.jboss.security.SimplePrincipal;
 import org.w3c.dom.Element;
 
@@ -124,7 +125,7 @@
 
       if (meta.getRunAs() != null)
       {
-         advisor.getDefaultMetaData().addMetaData("security", "run-as", new SimplePrincipal(meta.getRunAs()), PayloadKey.TRANSIENT);
+         advisor.getDefaultMetaData().addMetaData("security", "run-as", new RunAsIdentity(meta.getRunAs(), null), PayloadKey.TRANSIENT);
       }
    }
 




More information about the jboss-cvs-commits mailing list