[jboss-cvs] JBossAS SVN: r86126 - in branches/Branch_5_x: security and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 19 15:46:45 EDT 2009


Author: anil.saldhana at jboss.com
Date: 2009-03-19 15:46:45 -0400 (Thu, 19 Mar 2009)
New Revision: 86126

Added:
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java
   branches/Branch_5_x/server/src/main/org/jboss/web/deployers/SecurityActions.java
   branches/Branch_5_x/testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml
   branches/Branch_5_x/testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml
Removed:
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java
   branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java
Modified:
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/security/.classpath
   branches/Branch_5_x/security/build.xml
   branches/Branch_5_x/security/pom.xml
   branches/Branch_5_x/server/src/etc/deployers/security-deployer-jboss-beans.xml
   branches/Branch_5_x/server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java
   branches/Branch_5_x/server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java
   branches/Branch_5_x/server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java
   branches/Branch_5_x/testsuite/imports/sections/security.xml
   branches/Branch_5_x/testsuite/imports/sections/web.xml
Log:
JBAS-6605: JBAS-6639: JBAS-6425:

Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -80,7 +80,7 @@
     <version.org.jboss.naming>5.0.1.GA</version.org.jboss.naming>
     <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
     <version.org.jboss.remoting>2.5.0.SP2</version.org.jboss.remoting>
-    <version.org.jboss.security>2.0.2.SP7</version.org.jboss.security>
+    <version.org.jboss.security>2.0.3.SP1</version.org.jboss.security>
     <version.org.jboss.threads>1.0.0.CR2</version.org.jboss.threads>
     <version.org.jboss.vfs>2.1.0.GA</version.org.jboss.vfs>
     <version.org.jboss.xnio.metadata>1.0.0.CR1</version.org.jboss.xnio.metadata>
@@ -2036,7 +2036,7 @@
       <dependency>
         <groupId>org.jboss.security</groupId>
         <artifactId>jbossxacml</artifactId>
-        <version>2.0.3.CR1</version>
+        <version>2.0.3.CR2</version>
         <exclusions>
           <exclusion>
             <groupId>sun-jaf</groupId>

Modified: branches/Branch_5_x/security/.classpath
===================================================================
--- branches/Branch_5_x/security/.classpath	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/security/.classpath	2009-03-19 19:46:45 UTC (rev 86126)
@@ -12,5 +12,6 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/jnp-client/lib/jnp-client.jar" sourcepath="/thirdparty/jboss/jnpserver/lib/jnpserver-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-dependency.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-dependency-sources.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-kernel.jar" sourcepath="/thirdparty/jboss/microcontainer/lib/jboss-kernel-sources.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/security/lib/jbossxacml.jar" sourcepath="/thirdparty/jboss/security/lib/jbossxacml-sources.jar"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: branches/Branch_5_x/security/build.xml
===================================================================
--- branches/Branch_5_x/security/build.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/security/build.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -99,12 +99,15 @@
       <path refid="jboss.jboss.man.classpath"/>
       <path refid="jboss.jboss.mdr.classpath"/>
       <path refid="jboss.jboss.reflect.classpath"/>
+      <path refid="jboss.jboss.vfs.classpath"/>
       <path refid="jboss.microcontainer.classpath"/>
       <path refid="jboss.jnpserver.classpath"/>
       <path refid="jboss.jboss.security.spi.classpath"/>
       <path refid="jboss.jbosssx.classpath"/>
+      <path refid="jboss.security.classpath"/>
       <path refid="jboss.system.classpath"/>
       <path refid="jboss.systemjmx.classpath"/>
+      <path refid="stax.api.classpath"/>
     </path>
 
     <!-- ===== -->

Modified: branches/Branch_5_x/security/pom.xml
===================================================================
--- branches/Branch_5_x/security/pom.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/security/pom.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -100,6 +100,11 @@
       <groupId>org.jboss.security</groupId>
       <artifactId>jbosssx-client</artifactId>
     </dependency>
+
+    <dependency>
+      <groupId>org.jboss.security</groupId>
+      <artifactId>jbossxacml</artifactId>
+    </dependency>
     
     <dependency>
       <groupId>junit</groupId>

Copied: branches/Branch_5_x/security/src/main/org/jboss/security/deployers (from rev 86077, trunk/security/src/main/org/jboss/security/deployers)

Deleted: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java
===================================================================
--- trunk/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java	2009-03-18 21:52:30 UTC (rev 86077)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.security.deployers;
-
-import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
-import org.jboss.security.acl.config.ACLConfiguration;
-import org.jboss.security.acl.config.ACLConfigurationFactory;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Parsing Deployer for ACL jboss-acl-policy.xml that 
- * can be present in EJB/Web Deployments
- * @author Anil.Saldhana at redhat.com
- * @since Mar 18, 2009
- */
-public class AclConfigParsingDeployer extends SchemaResolverDeployer<ACLConfiguration>
-{ 
-   public AclConfigParsingDeployer()
-   {
-      super(ACLConfiguration.class);
-      setName("jboss-acl-policy.xml");
-   }
-
-   @Override
-   protected ACLConfiguration parse(VirtualFile file) throws Exception
-   {
-      return ACLConfigurationFactory.getConfiguration(file.openStream());
-   } 
-}
\ No newline at end of file

Copied: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java (from rev 86077, trunk/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java)
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java	                        (rev 0)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/AclConfigParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.security.deployers;
+
+import org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer;
+import org.jboss.security.acl.config.ACLConfiguration;
+import org.jboss.security.acl.config.ACLConfigurationFactory;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Parsing Deployer for ACL jboss-acl-policy.xml that 
+ * can be present in EJB/Web Deployments
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 18, 2009
+ */
+public class AclConfigParsingDeployer extends SchemaResolverDeployer<ACLConfiguration>
+{ 
+   public AclConfigParsingDeployer()
+   {
+      super(ACLConfiguration.class);
+      setName("jboss-acl-policy.xml");
+   }
+
+   @Override
+   protected ACLConfiguration parse(VirtualFile file) throws Exception
+   {
+      return ACLConfigurationFactory.getConfiguration(file.openStream());
+   } 
+}
\ No newline at end of file

Deleted: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java
===================================================================
--- trunk/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java	2009-03-18 21:52:30 UTC (rev 86077)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.security.deployers;
-
-import java.io.InputStream;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;  
-import javax.xml.bind.Unmarshaller;
-
-import org.jboss.deployers.vfs.spi.deployer.JAXBDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit; 
-import org.jboss.virtual.VirtualFile;
-import org.xml.sax.InputSource;
-
-/**
- * A parsing deployer that is capable of parsing
- * a JAXB model with the root element being
- * JAXBElement<T>
- * 
- * @author Anil.Saldhana at redhat.com
- * @since Mar 17, 2009
- */
- at SuppressWarnings("unchecked")
-public class JAXBElementParsingDeployer<T,V> extends JAXBDeployer 
-{
-   /** The JAXBContext */ 
-   protected JAXBContext context;
-
-   /** The properties */
-   protected Map<String, Object> properties;
-   
-   protected Class<V> enclosed;
-    
-   /**
-    * CTR
-    * @param output  JAXBElement.class
-    * @param enclosed Type enclosed by JAXBElement
-    */
-   public JAXBElementParsingDeployer(Class<T> output, Class<V> enclosed)
-   {
-      super(output); 
-      this.enclosed = enclosed;
-   } 
-   
-   /**
-    * Create lifecycle
-    * 
-    * @throws Exception for any problem
-    */
-   @Override
-   public void create() throws Exception
-   {
-      if (properties != null)
-         context = JAXBContext.newInstance(new Class[] {enclosed}, properties);
-      else
-         context = JAXBContext.newInstance(enclosed);
-   } 
-
-   /**
-    * Destroy lifecycle
-    */
-   public void destroy()
-   {
-      context = null;
-   }
-
-   @Override
-   protected Object parse(VFSDeploymentUnit unit, VirtualFile file, Object root) throws Exception
-   {
-      Unmarshaller unmarshaller = context.createUnmarshaller();
-      InputStream is = openStreamAndValidate(file);
-      try
-      {
-         InputSource source = new InputSource(is);
-         source.setSystemId(file.toURI().toString());
-         Object o = unmarshaller.unmarshal(source);
-         return getOutput().cast(o);
-      }
-      finally
-      {
-         try
-         {
-            is.close();
-         }
-         catch (Exception ignored)
-         {
-         }
-      }
-   } 
-}

Copied: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java (from rev 86077, trunk/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java)
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java	                        (rev 0)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/JAXBElementParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.security.deployers;
+
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;  
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.deployers.vfs.spi.deployer.JAXBDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit; 
+import org.jboss.virtual.VirtualFile;
+import org.xml.sax.InputSource;
+
+/**
+ * A parsing deployer that is capable of parsing
+ * a JAXB model with the root element being
+ * JAXBElement<T>
+ * 
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 17, 2009
+ */
+ at SuppressWarnings("unchecked")
+public class JAXBElementParsingDeployer<T,V> extends JAXBDeployer 
+{
+   /** The JAXBContext */ 
+   protected JAXBContext context;
+
+   /** The properties */
+   protected Map<String, Object> properties;
+   
+   protected Class<V> enclosed;
+    
+   /**
+    * CTR
+    * @param output  JAXBElement.class
+    * @param enclosed Type enclosed by JAXBElement
+    */
+   public JAXBElementParsingDeployer(Class<T> output, Class<V> enclosed)
+   {
+      super(output); 
+      this.enclosed = enclosed;
+   } 
+   
+   /**
+    * Create lifecycle
+    * 
+    * @throws Exception for any problem
+    */
+   @Override
+   public void create() throws Exception
+   {
+      if (properties != null)
+         context = JAXBContext.newInstance(new Class[] {enclosed}, properties);
+      else
+         context = JAXBContext.newInstance(enclosed);
+   } 
+
+   /**
+    * Destroy lifecycle
+    */
+   public void destroy()
+   {
+      context = null;
+   }
+
+   @Override
+   protected Object parse(VFSDeploymentUnit unit, VirtualFile file, Object root) throws Exception
+   {
+      Unmarshaller unmarshaller = context.createUnmarshaller();
+      InputStream is = openStreamAndValidate(file);
+      try
+      {
+         InputSource source = new InputSource(is);
+         source.setSystemId(file.toURI().toString());
+         Object o = unmarshaller.unmarshal(source);
+         return getOutput().cast(o);
+      }
+      finally
+      {
+         try
+         {
+            is.close();
+         }
+         catch (Exception ignored)
+         {
+         }
+      }
+   } 
+}

Deleted: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java
===================================================================
--- trunk/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java	2009-03-18 21:52:30 UTC (rev 86077)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.security.deployers;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.security.xacml.jaxb.PDP;
-
-/**
- * Parsing Deployer for JBossXACML Config
- * @author Anil.Saldhana at redhat.com
- * @since Mar 17, 2009
- */
- at SuppressWarnings("unchecked")
-public class XacmlConfigParsingDeployer extends JAXBElementParsingDeployer<JAXBElement,PDP>
-{ 
-   public final static String XACML_ATTACHMENT_NAME = "xacml.config";
-   
-   protected JAXBContext context;
-   
-   public XacmlConfigParsingDeployer()
-   {
-      super(JAXBElement.class,PDP.class); 
-      setName("jbossxacml-config.xml"); 
-   } 
-   
-
-   /**
-    * Get the Config File Name
-    * @return
-    */
-   public String getConfigFileName()
-   {
-      return getName();
-   }
-   
-   /**
-    * Set the JBossXACML Config File Name
-    * @param fileName
-    */
-   public void setConfigFileName(String fileName)
-   {
-      this.setName(fileName);
-   }
-
-
-   /**
-    * Method overridden to make the attachment name to be not the same as
-    * the deployment type but a custom name
-    */
-   @Override
-   protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
-   {
-      createMetaData(unit, name, suffix, XACML_ATTACHMENT_NAME);
-   } 
-}

Copied: branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java (from rev 86077, trunk/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java)
===================================================================
--- branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java	                        (rev 0)
+++ branches/Branch_5_x/security/src/main/org/jboss/security/deployers/XacmlConfigParsingDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.security.deployers;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.security.xacml.jaxb.PDP;
+
+/**
+ * Parsing Deployer for JBossXACML Config
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 17, 2009
+ */
+ at SuppressWarnings("unchecked")
+public class XacmlConfigParsingDeployer extends JAXBElementParsingDeployer<JAXBElement,PDP>
+{ 
+   public final static String XACML_ATTACHMENT_NAME = "xacml.config";
+   
+   protected JAXBContext context;
+   
+   public XacmlConfigParsingDeployer()
+   {
+      super(JAXBElement.class,PDP.class); 
+      setName("jbossxacml-config.xml"); 
+   } 
+   
+
+   /**
+    * Get the Config File Name
+    * @return
+    */
+   public String getConfigFileName()
+   {
+      return getName();
+   }
+   
+   /**
+    * Set the JBossXACML Config File Name
+    * @param fileName
+    */
+   public void setConfigFileName(String fileName)
+   {
+      this.setName(fileName);
+   }
+
+
+   /**
+    * Method overridden to make the attachment name to be not the same as
+    * the deployment type but a custom name
+    */
+   @Override
+   protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
+   {
+      createMetaData(unit, name, suffix, XACML_ATTACHMENT_NAME);
+   } 
+}

Modified: branches/Branch_5_x/server/src/etc/deployers/security-deployer-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/deployers/security-deployer-jboss-beans.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/server/src/etc/deployers/security-deployer-jboss-beans.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -5,7 +5,7 @@
 -->
 <deployment xmlns="urn:jboss:bean-deployer:2.0"> 
 
-      <!-- Instance of Policy Registration -->
+   <!-- Instance of Policy Registration -->
    <bean name="JBossSecurityPolicyRegistration"
          class="org.jboss.security.plugins.JBossPolicyRegistration" />
 
@@ -26,4 +26,9 @@
       <property name="registerWithJBossXB">true</property>
    </bean>
 
+   <!--Deployer for JBossXACML Config -->
+   <bean name="XACMLParsingDeployer"
+            class="org.jboss.security.deployers.XacmlConfigParsingDeployer" />
+
+   <bean name="ACLParsingDeployer" class="org.jboss.security.deployers.AclConfigParsingDeployer"/>
 </deployment>

Modified: branches/Branch_5_x/server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/server/src/main/org/jboss/deployment/security/AbstractSecurityDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -24,20 +24,20 @@
 import java.util.ArrayList;
 
 import javax.management.ObjectName;
+import javax.xml.bind.JAXBElement;
 
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.metadata.javaee.support.IdMetaData;
+import org.jboss.security.acl.config.ACLConfiguration;
 import org.jboss.security.authorization.PolicyRegistration;
 import org.jboss.system.metadata.ServiceAttributeMetaData;
 import org.jboss.system.metadata.ServiceConstructorMetaData;
 import org.jboss.system.metadata.ServiceDependencyMetaData;
 import org.jboss.system.metadata.ServiceDependencyValueMetaData;
 import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.virtual.VirtualFile;
 
 /**
  * Abstract Security Deployer Sets up the top level JaccPolicy service beans
@@ -52,10 +52,9 @@
 
    private static final String BASE_OBJECT_NAME = "jboss.jacc:service=jacc,id=";
 
-   private static final String XACML_POLICY_FILE_NAME = "jboss-xacml-policy.xml";
+   /** Attachment name for the JAXB model for xacml config - match the one from XacmlConfigParsingDeployer */
+   private static final String XACML_ATTACHMENT_NAME = "xacml.config";  
 
-   private static final String ACL_POLICY_FILE_NAME = "jboss-acl-policy.xml";
-
    private PolicyRegistration policyRegistration;
 
    /**
@@ -141,29 +140,20 @@
             parentServiceMetaData.addAttribute(serviceAttributeMetaData);
          }
       }
-
-      // if policy registration has been set, check the deployments for XACML and ACL configuration files.
-      if (this.policyRegistration != null && unit instanceof VFSDeploymentUnit)
+      
+      /** Register XACML/ACL policies if present in the deployment */
+      if(this.policyRegistration != null)
       {
-         VFSDeploymentUnit deploymentUnit = (VFSDeploymentUnit) unit;
-         try
-         {
-            VirtualFile xacmlFile = deploymentUnit.getMetaDataFile(XACML_POLICY_FILE_NAME);
-            if (xacmlFile != null)
-            {
-               this.policyRegistration.registerPolicy(contextId, PolicyRegistration.XACML, xacmlFile.toURL());
-            }
-            VirtualFile aclPolicyFile = deploymentUnit.getMetaDataFile(ACL_POLICY_FILE_NAME);
-            if (aclPolicyFile != null)
-            {
-               this.policyRegistration.registerPolicy(contextId, PolicyRegistration.ACL, aclPolicyFile.toURL());
-            }
-         }
-         catch (Exception e)
-         {
-            super.log.debug("Fail to process security configuration file", e);
-         }
-      }
+         String xacmlType = PolicyRegistration.XACML;
+         JAXBElement<?> policyConfig = (JAXBElement<?>) unit.getAttachment(XACML_ATTACHMENT_NAME);
+         if(policyConfig != null)
+            this.policyRegistration.registerPolicyConfig(contextId, xacmlType, policyConfig);
+         
+         String aclType = PolicyRegistration.ACL;
+         ACLConfiguration aclConfig = (ACLConfiguration) unit.getAttachment(ACLConfiguration.class.getName());
+         if(aclConfig != null)
+            this.policyRegistration.registerPolicyConfig(contextId, aclType, aclConfig);   
+      } 
    }
 
    @Override

Modified: branches/Branch_5_x/server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/server/src/main/org/jboss/deployment/security/EjbPolicyConfigurationFacade.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -27,8 +27,7 @@
 import org.jboss.ejb.EJBPermissionMapping;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaDataWrapper;
+import org.jboss.metadata.ejb.jboss.JBossMetaData; 
 
 //$Id$
 

Copied: branches/Branch_5_x/server/src/main/org/jboss/web/deployers/SecurityActions.java (from rev 86077, trunk/server/src/main/org/jboss/web/deployers/SecurityActions.java)
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/web/deployers/SecurityActions.java	                        (rev 0)
+++ branches/Branch_5_x/server/src/main/org/jboss/web/deployers/SecurityActions.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.web.deployers;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Privileged Blocks
+ * @author Anil.Saldhana at redhat.com
+ * @since Mar 18, 2009
+ */
+class SecurityActions
+{
+   static ClassLoader getContextClassLoader()
+   {
+      return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+      {
+         public ClassLoader run()
+         { 
+            return Thread.currentThread().getContextClassLoader();
+         }
+      });
+   }
+   
+   static void setContextClassLoader(final ClassLoader tcl)
+   {
+      AccessController.doPrivileged(new PrivilegedAction<Object>()
+      {
+         public Object run()
+         { 
+            Thread.currentThread().setContextClassLoader(tcl);
+            return null;
+         }
+      });
+   } 
+}

Modified: branches/Branch_5_x/server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java
===================================================================
--- branches/Branch_5_x/server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/server/src/main/org/jboss/web/deployers/WarSecurityDeployer.java	2009-03-19 19:46:45 UTC (rev 86126)
@@ -21,6 +21,8 @@
  */
 package org.jboss.web.deployers;
 
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployment.security.AbstractSecurityDeployer;
 import org.jboss.deployment.security.WarJaccPolicy;
 import org.jboss.deployment.security.WarPolicyConfigurationFacade;
@@ -30,14 +32,35 @@
 //$Id$
 
 /**
- *  Security Deployer for war
+ *  Security Deployer for Web Archives 
  *  @author Anil.Saldhana at redhat.com
  *  @since  Feb 17, 2008 
  *  @version $Revision$
  */
 public class WarSecurityDeployer extends AbstractSecurityDeployer<JBossWebMetaData>
-{     
+{   
+   
    @Override
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   { 
+      ClassLoader oldCL = null;
+      // Set the TCL
+      try
+      {
+         //JBAS-6607: JBossXACML needs the tcl to locate the xacml policies
+         //The TCL would be the CL for VFS for the security deployer beans
+         //Deployment Unit CL would be the war CL. Hence pick the DU CL as TCL.
+         oldCL = SecurityActions.getContextClassLoader();
+         SecurityActions.setContextClassLoader(unit.getClassLoader()); 
+         super.deploy(unit);
+      }
+      finally
+      {
+         SecurityActions.setContextClassLoader(oldCL); 
+      } 
+   }
+
+   @Override
    protected ServiceMetaData getServiceMetaData()
    {
       ServiceMetaData serviceMetaData = new ServiceMetaData();

Modified: branches/Branch_5_x/testsuite/imports/sections/security.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/sections/security.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/testsuite/imports/sections/security.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -345,6 +345,7 @@
             <include name="ejb-jar.xml" />
             <include name="jboss.xml" />
             <include name="jboss-xacml-policy.xml" />
+            <include name="jbossxacml-config.xml" />
          </metainf>
          <fileset dir="${build.classes}">
             <include name="org/jboss/test/security/ejb/StatelessSessionBean4.*"/>

Modified: branches/Branch_5_x/testsuite/imports/sections/web.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/sections/web.xml	2009-03-19 19:46:41 UTC (rev 86125)
+++ branches/Branch_5_x/testsuite/imports/sections/web.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -541,13 +541,16 @@
       <war warfile="${build.lib}/xacml-requestattrib.war"
          webxml="${build.resources}/web/xacml/requestAttrib/WEB-INF/web.xml"> 
          <webinf dir="${build.resources}/web/xacml/requestAttrib/WEB-INF/">
-           <include name="*policy.xml"/> 
+           <include name="jbossxacml-config.xml"/> 
            <include name="jboss-web.xml"/>
          </webinf> 
          <zipfileset dir="${build.resources}/web" prefix="WEB-INF/classes">
             <include name="users.properties"/>
             <include name="roles.properties"/>
          </zipfileset>
+         <zipfileset dir="${build.resources}/web/xacml/requestAttrib/WEB-INF" prefix="WEB-INF/classes">
+            <include name="jboss-xacml-policy.xml"/>
+         </zipfileset>
          <fileset dir="${build.resources}/web/xacml/requestAttrib">
             <include name="**/*.html"/>
             <include name="**/*.jsp"/>
@@ -556,15 +559,16 @@
       <war warfile="${build.lib}/xacml-subjectrole.war"
          webxml="${build.resources}/web/xacml/requestAttrib/WEB-INF/web.xml"> 
          <webinf dir="${build.resources}/web/xacml/requestAttrib/WEB-INF/">
+           <include name="jbossxacml-config.xml"/>
            <include name="jboss-web.xml"/>
          </webinf> 
-         <webinf dir="${build.resources}/web/xacml/subjectRole/WEB-INF/">
-           <include name="*policy.xml"/> 
-         </webinf> 
          <zipfileset dir="${build.resources}/web" prefix="WEB-INF/classes">
             <include name="users.properties"/>
             <include name="roles.properties"/>
          </zipfileset>
+         <zipfileset dir="${build.resources}/web/xacml/subjectRole/WEB-INF" prefix="WEB-INF/classes">
+            <include name="jboss-xacml-policy.xml"/>
+         </zipfileset>
          <fileset dir="${build.resources}/web/xacml/requestAttrib">
             <include name="**/*.html"/>
             <include name="**/*.jsp"/>

Copied: branches/Branch_5_x/testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml (from rev 86077, trunk/testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml)
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/security/authorization/xacml-ejb/META-INF/jbossxacml-config.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,11 @@
+<ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">
+  <ns:Policies>
+    <ns:Policy>
+       <ns:Location>META-INF/jboss-xacml-policy.xml</ns:Location>
+     </ns:Policy>
+  </ns:Policies>
+  <ns:Locators>
+    <ns:Locator Name="org.jboss.security.xacml.locators.JBossPolicySetLocator"/> 
+    <ns:Locator Name="org.jboss.security.xacml.locators.JBossPolicyLocator"/> 
+  </ns:Locators>
+</ns:jbosspdp>

Copied: branches/Branch_5_x/testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml (from rev 86077, trunk/testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml)
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/web/xacml/requestAttrib/WEB-INF/jbossxacml-config.xml	2009-03-19 19:46:45 UTC (rev 86126)
@@ -0,0 +1,11 @@
+<ns:jbosspdp xmlns:ns="urn:jboss:xacml:2.0">
+  <ns:Policies>
+    <ns:Policy>
+       <ns:Location>jboss-xacml-policy.xml</ns:Location>
+    </ns:Policy>
+  </ns:Policies>
+  <ns:Locators>
+    <ns:Locator Name="org.jboss.security.xacml.locators.JBossPolicySetLocator"/>
+    <ns:Locator Name="org.jboss.security.xacml.locators.JBossPolicyLocator"/>
+  </ns:Locators>
+</ns:jbosspdp>




More information about the jboss-cvs-commits mailing list