[jboss-cvs] JBossAS SVN: r65274 - in trunk/testsuite: src/main/org/jboss/test/aop/bean and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 10 05:37:00 EDT 2007
Author: kabir.khan at jboss.com
Date: 2007-09-10 05:37:00 -0400 (Mon, 10 Sep 2007)
New Revision: 65274
Added:
trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureInternalPOJO.java
trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureRunAsPOJO.java
trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureInternalPOJO.java
trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureRunAsPOJO.java
Modified:
trunk/testsuite/imports/sections/aop.xml
trunk/testsuite/src/main/org/jboss/test/aop/bean/SecurityTester.java
trunk/testsuite/src/resources/aop/META-INF/jboss-aop.xml
Log:
[JBAS-4547] Test RunAsSecurityInterceptor
Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml 2007-09-10 09:35:49 UTC (rev 65273)
+++ trunk/testsuite/imports/sections/aop.xml 2007-09-10 09:37:00 UTC (rev 65274)
@@ -84,8 +84,12 @@
name="org/jboss/test/aop/bean/NoInterceptorsPOJO*.class"/>
<include name="org/jboss/test/aop/bean/NonadvisedPOJO.class"/>
<include name="org/jboss/test/aop/bean/SecuredPOJO.class"/>
+ <include name="org/jboss/test/aop/bean/SecureRunAsPOJO.class"/>
+ <include name="org/jboss/test/aop/bean/SecureInternalPOJO.class"/>
<include
name="org/jboss/test/aop/bean/AnnotatedSecuredPOJO.class"/>
+ <include name="org/jboss/test/aop/bean/AnnotatedSecureRunAsPOJO.class"/>
+ <include name="org/jboss/test/aop/bean/AnnotatedSecureInternalPOJO.class"/>
<include name="org/jboss/test/aop/bean/SomeException.class"/>
<include name="org/jboss/test/aop/bean/POJO*.class"/>
<include name="org/jboss/test/aop/bean/Call*.class"/>
Added: trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureInternalPOJO.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureInternalPOJO.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureInternalPOJO.java 2007-09-10 09:37:00 UTC (rev 65274)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.bean;
+
+import org.jboss.aspects.security.Permissions;
+import org.jboss.aspects.security.SecurityDomain;
+import org.jboss.aspects.security.Unchecked;
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at SecurityDomain ("other")
+public class AnnotatedSecureInternalPOJO
+{
+ @Unchecked
+ public AnnotatedSecureInternalPOJO()
+ {
+
+ }
+
+ @Permissions ({"allowed"})
+ public void wrongRole()
+ {
+
+ }
+
+ @Permissions ({"internal"})
+ public void correctRole()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureRunAsPOJO.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureRunAsPOJO.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/bean/AnnotatedSecureRunAsPOJO.java 2007-09-10 09:37:00 UTC (rev 65274)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.bean;
+
+import org.jboss.aspects.security.RunAs;
+import org.jboss.aspects.security.SecurityDomain;
+import org.jboss.aspects.security.Unchecked;
+import org.jboss.test.aop.bean.AnnotatedSecureInternalPOJO;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at SecurityDomain("other")
+ at RunAs("internal")
+public class AnnotatedSecureRunAsPOJO
+{
+ @Unchecked
+ AnnotatedSecureInternalPOJO pojo = new AnnotatedSecureInternalPOJO();
+
+ @Unchecked
+ boolean called;
+
+ @Unchecked
+ public void runAsWithCorrectRole()
+ {
+ called = true;
+ pojo.correctRole();
+ }
+
+
+ @Unchecked
+ public void runAsWithIncorrectRole()
+ {
+ called = true;
+ pojo.wrongRole();
+ }
+}
+
\ No newline at end of file
Added: trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureInternalPOJO.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureInternalPOJO.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureInternalPOJO.java 2007-09-10 09:37:00 UTC (rev 65274)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.bean;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SecureInternalPOJO
+{
+ public void wrongRole()
+ {
+
+ }
+
+ public void correctRole()
+ {
+
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureRunAsPOJO.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureRunAsPOJO.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/aop/bean/SecureRunAsPOJO.java 2007-09-10 09:37:00 UTC (rev 65274)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.aop.bean;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SecureRunAsPOJO
+{
+ AnnotatedSecureInternalPOJO pojo = new AnnotatedSecureInternalPOJO();
+ boolean called;
+ public void runAsWithCorrectRole()
+ {
+ called = true;
+ pojo.correctRole();
+ }
+
+ public void runAsWithIncorrectRole()
+ {
+ called = true;
+ pojo.wrongRole();
+ }
+}
Modified: trunk/testsuite/src/main/org/jboss/test/aop/bean/SecurityTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/bean/SecurityTester.java 2007-09-10 09:35:49 UTC (rev 65273)
+++ trunk/testsuite/src/main/org/jboss/test/aop/bean/SecurityTester.java 2007-09-10 09:37:00 UTC (rev 65274)
@@ -224,7 +224,7 @@
catch (Throwable ex)
{
log.error("failed", ex);
- throw new RuntimeException(ex.getMessage());
+ throw new RuntimeException(ex);
}
}
@@ -336,7 +336,7 @@
pojo.someMethod();
pojo.someField = 5;
pojo = new AnnotatedSecuredPOJO(5);
-
+
log.info("test exclusion");
securityFailure = true;
try
@@ -377,7 +377,7 @@
catch (Throwable ex)
{
log.error("failed", ex);
- throw new RuntimeException(ex.getMessage());
+ throw new RuntimeException(ex);
}
}
}
Modified: trunk/testsuite/src/resources/aop/META-INF/jboss-aop.xml
===================================================================
--- trunk/testsuite/src/resources/aop/META-INF/jboss-aop.xml 2007-09-10 09:35:49 UTC (rev 65273)
+++ trunk/testsuite/src/resources/aop/META-INF/jboss-aop.xml 2007-09-10 09:37:00 UTC (rev 65274)
@@ -389,6 +389,65 @@
</constructor>
</exclude-list>
</metadata>
+
+ <metadata tag="security" class="org.jboss.test.aop.bean.SecureRunAsPOJO">
+ <security-domain>other</security-domain>
+ <security-identity>
+ <run-as><role-name>internal</role-name></run-as>
+ </security-identity>
+ <method-permission>
+ <unchecked/>
+ <method>
+ <method-name>runAsWithCorrectRole</method-name>
+ </method>
+ </method-permission>
+ <method-permission>
+ <unchecked/>
+ <method>
+ <method-name>runAsWithIncorrectRole</method-name>
+ </method>
+ </method-permission>
+ <field-permission>
+ <unchecked/>
+ <field>
+ <field-name>called</field-name>
+ </field>
+ </field-permission>
+ <constructor-permission>
+ <unchecked/>
+ <constructor>
+ <constructor-params/>
+ </constructor>
+ </constructor-permission>
+ </metadata>
+
+ <metadata tag="security" class="org.jboss.test.aop.bean.SecureInternalPOJO">
+ <security-domain>other</security-domain>
+ <method-permission>
+ <role-name>allowed</role-name>
+ <method>
+ <method-name>wrongRole</method-name>
+ </method>
+ </method-permission>
+ <method-permission>
+ <role-name>internal</role-name>
+ <method>
+ <method-name>correctRole</method-name>
+ </method>
+ </method-permission>
+ <field-permission>
+ <unchecked/>
+ <field>
+ <field-name>called</field-name>
+ </field>
+ </field-permission>
+ <constructor-permission>
+ <unchecked/>
+ <constructor>
+ <constructor-params/>
+ </constructor>
+ </constructor-permission>
+ </metadata>
<!-- Observable tester -->
More information about the jboss-cvs-commits
mailing list