[jboss-cvs] JBossAS SVN: r99786 - in projects/security/picketbox/fresh/security-jboss-sx: identity and 11 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 21 17:30:26 EST 2010


Author: anil.saldhana at jboss.com
Date: 2010-01-21 17:30:26 -0500 (Thu, 21 Jan 2010)
New Revision: 99786

Added:
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
Modified:
   projects/security/picketbox/fresh/security-jboss-sx/acl/pom.xml
   projects/security/picketbox/fresh/security-jboss-sx/identity/pom.xml
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx-mc-int/pom.xml
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/pom.xml
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
   projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/acl/JBossAuthorizationManagerACLUnitTestCase.java
   projects/security/picketbox/fresh/security-jboss-sx/parent/pom.xml
Log:
changes for getting a standalone version

Modified: projects/security/picketbox/fresh/security-jboss-sx/acl/pom.xml
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/acl/pom.xml	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/acl/pom.xml	2010-01-21 22:30:26 UTC (rev 99786)
@@ -3,6 +3,7 @@
       <groupId>org.jboss.security</groupId>
       <artifactId>jbosssx-parent</artifactId>
       <version>2.1.0.20091223-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>jboss-security-acl-impl</artifactId>
@@ -49,9 +50,8 @@
    </profiles>
    <dependencies> 
       <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-logging-log4j</artifactId>
-         <scope>runtime</scope>
+         <groupId>org.jboss.logging</groupId>
+         <artifactId>jboss-logging-spi</artifactId>
       </dependency>
       <dependency>
          <groupId>org.hibernate</groupId>
@@ -84,6 +84,12 @@
       </dependency>
       <dependency>
          <groupId>org.jboss.security</groupId>
+         <artifactId>acl-spi</artifactId>
+         <version>${project.version}</version>
+         <scope>compile</scope>
+      </dependency>    
+      <dependency>
+         <groupId>org.jboss.security</groupId>
          <artifactId>identity-impl</artifactId>
          <version>${project.version}</version>
          <scope>compile</scope>

Modified: projects/security/picketbox/fresh/security-jboss-sx/identity/pom.xml
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/identity/pom.xml	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/identity/pom.xml	2010-01-21 22:30:26 UTC (rev 99786)
@@ -3,6 +3,7 @@
       <groupId>org.jboss.security</groupId>
       <artifactId>jbosssx-parent</artifactId>
       <version>2.1.0.20091223-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>identity-impl</artifactId>
@@ -50,10 +51,17 @@
    <dependencies> 
       <dependency>
          <groupId>org.jboss.security</groupId>
-         <artifactId>jboss-security-spi</artifactId>
+         <artifactId>jboss-security-spi-bare</artifactId>
+         <version>${project.version}</version>
          <scope>compile</scope>
       </dependency>
       <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>identity-spi</artifactId>
+         <version>${project.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/pom.xml
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/pom.xml	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/pom.xml	2010-01-21 22:30:26 UTC (rev 99786)
@@ -3,6 +3,7 @@
       <groupId>org.jboss.security</groupId>
       <artifactId>jbosssx-parent</artifactId>
       <version>2.1.0.20091223-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>jbosssx-bare</artifactId>
@@ -126,6 +127,12 @@
          <scope>compile</scope>
       </dependency>
       <dependency>
+         <groupId>org.jboss.security</groupId>
+         <artifactId>acl-spi</artifactId>
+         <version>${project.version}</version>
+         <scope>compile</scope>
+      </dependency>
+      <dependency>
          <groupId>org.jboss.javaee</groupId>
          <artifactId>jboss-javaee</artifactId>
          <version>5.0.0.GA</version>
@@ -138,15 +145,9 @@
          </exclusions>
       </dependency>
       <dependency>
-         <groupId>jboss</groupId>
-         <artifactId>jboss-jmx</artifactId>
-         <version>4.2.1.GA</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
          <groupId>org.jboss.security</groupId>
          <artifactId>jbossxacml</artifactId>
-         <version>2.0.3.CR2</version>
+         <version>2.0.4</version>
          <scope>compile</scope>
       </dependency>
       <dependency>
@@ -178,6 +179,12 @@
          <scope>test</scope>
       </dependency>
       <dependency>
+         <groupId>org.jboss</groupId>
+         <artifactId>jboss-common-core</artifactId>
+         <version>2.2.17.GA</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
          <groupId>sleepycat</groupId>
          <artifactId>je</artifactId>
          <version>3.2.43</version>

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/resource/security/AbstractPasswordCredentialLoginModule.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -32,7 +32,7 @@
 import javax.security.auth.login.LoginException;
 
 import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
 import org.jboss.security.auth.spi.AbstractServerLoginModule;
 
 

Added: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java	                        (rev 0)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLBaseDefinition.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -0,0 +1,128 @@
+/*
+ * 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.acl.config;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.acl.ACLEntry;
+
+/**
+ * <p>
+ * A container for holding the contents parsed from a {@code <acl-definition>} section of {@code jboss-acl.xml}.
+ * </p>
+ * 
+ * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
+ * @since Jan 21, 2010
+ */
+public class ACLBaseDefinition
+{
+   protected static Logger logger = Logger.getLogger(ACLBaseDefinition.class);
+
+   protected String resource;
+
+   protected String baseResource;
+
+   protected final Set<ACLEntry> entries = new HashSet<ACLEntry>();
+
+   /**
+    * <p>
+    * Adds a parsed {@code ACLEntry} to the list of entries of this {@code ACLDefinition}.
+    * </p>
+    * 
+    * @param entry the {@code ACLEntry} to be added.
+    */
+   public void addACLEntry(Object entry)
+   {
+      logger.debug("addEntry: " + entry);
+
+      if (entry instanceof ACLEntry)
+         this.entries.add((ACLEntry) entry);
+   }
+
+   /**
+    * <p>
+    * Obtains the configured {@code <acl-definition>} resource.
+    * </p>
+    * 
+    * @return a {@code String} containing the resource as configured in the XML file.
+    */
+   public String getResource()
+   {
+      return resource;
+   }
+
+   /**
+    * <p>
+    * Obtains the configured {@code <acl-definition>} base-resource, as per the {@code extends} attribute in the XML
+    * file.
+    * </p>
+    * 
+    * @return a {@code String} containing the base-resource as configured in the XML file, or {@code null} if no base
+    *         resource is available.
+    */
+   public String getBaseResource()
+   {
+      return baseResource;
+   }
+
+   /**
+    * <p>
+    * Obtains the ACL entries that have been configured in this ACL definition.
+    * </p>
+    * 
+    * @return a {@code List<ACLEntry>} containing the configured entries.
+    */
+   public Set<ACLEntry> getEntries()
+   {
+      return entries;
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see java.lang.Object#equals(java.lang.Object)
+    */
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj instanceof ACLDefinition)
+      {
+         ACLBaseDefinition other = (ACLBaseDefinition) obj;
+         return this.resource.equals(other.resource);
+      }
+      return false;
+   }
+
+   /*
+    * (non-Javadoc)
+    * 
+    * @see java.lang.Object#hashCode()
+    */
+   @Override
+   public int hashCode()
+   {
+      return this.resource.hashCode();
+   }
+
+}
\ No newline at end of file

Added: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java	                        (rev 0)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParser.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -0,0 +1,39 @@
+/*
+ * 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.acl.config;
+
+import java.io.InputStream;
+
+/**
+ * Parses the ACL Configuration
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 20, 2010
+ */
+public interface ACLConfigParser
+{
+   /**
+    * Given a stream of acl config, returns {@code ACLConfiguration}
+    * @param aclConfigFileStream
+    * @return
+    */
+   ACLConfiguration getConfiguration(InputStream aclConfigFileStream);
+}
\ No newline at end of file

Added: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java	                        (rev 0)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserJBossXB.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -0,0 +1,60 @@
+/*
+ * 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.acl.config;
+
+import java.io.InputStream;
+
+import org.jboss.logging.Logger;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+
+/**
+ * A JBossXB based acl config parser
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 20, 2010
+ */
+public class ACLConfigParserJBossXB implements ACLConfigParser
+{
+   private static final String schemaName = "schema/jboss-acl-config_1_0.xsd";
+
+   private static Logger log = Logger.getLogger(ACLConfigParserJBossXB.class);
+
+   public ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
+   {
+      ClassLoader tcl = SecurityActions.getContextClassLoader();
+      SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaName), null);
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      try
+      {
+         ACLConfiguration configuration = (ACLConfiguration) unmarshaller.unmarshal(aclConfigFileStream, schema);
+         return configuration;
+      }
+      catch (JBossXBException e)
+      {
+         log.debug("Error parsing ACL configuration file", e);
+         throw new RuntimeException(e);
+      }
+   }
+}
\ No newline at end of file

Added: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java	                        (rev 0)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigParserStax.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -0,0 +1,40 @@
+/*
+ * 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.acl.config;
+
+import java.io.InputStream;
+
+/**
+ * ACL Config Parser based on STAX
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 20, 2010
+ */
+public class ACLConfigParserStax implements ACLConfigParser
+{   
+   /**
+    * @see ACLConfigParser#getConfiguration(InputStream)
+    */
+   public ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
+   {
+      return null;
+   }
+}
\ No newline at end of file

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfiguration.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -45,7 +45,7 @@
 {
 
    /** the set of ACL definitions keyed by their resource identifier. */
-   private final Map<String, ACLDefinition> definitions = new HashMap<String, ACLDefinition>();
+   private final Map<String, ACLBaseDefinition> definitions = new HashMap<String, ACLBaseDefinition>();
 
    /**
     * <p>
@@ -56,9 +56,9 @@
     */
    public void addDefinition(Object definition)
    {
-      if (definition instanceof ACLDefinition)
+      if (definition instanceof ACLBaseDefinition)
       {
-         ACLDefinition aclDefinition = (ACLDefinition) definition;
+         ACLBaseDefinition aclDefinition = (ACLBaseDefinition) definition;
          this.definitions.put(aclDefinition.getResource(), aclDefinition);
       }
    }
@@ -74,7 +74,7 @@
    public Set<ACL> getConfiguredACLs()
    {
       Set<ACL> configuredACLs = new HashSet<ACL>();
-      for (ACLDefinition definition : this.definitions.values())
+      for (ACLBaseDefinition definition : this.definitions.values())
       {
          Set<ACLEntry> entries = this.getEntries(definition, new ArrayList<String>());
          ACLImpl acl = new ACLImpl(definition.getResource(), entries);
@@ -90,13 +90,13 @@
     * "inherits" the entries from its parent and is free to add or override entries as needed.
     * </p>
     * 
-    * @param definition the {@code ACLDefinition} that contains the data used to retrieve the entries.
+    * @param definition the {@code ACLBaseDefinition} that contains the data used to retrieve the entries.
     * @param visitedACLs a {@code List} of the visited ACLs to detect circular dependencies.
     * @return a {@code Set<ACLEntry>} containing the entries that will be used to create an {@code ACL} according to the
     *         specified definition.
     * @throws RuntimeException if a circular dependency is detected among the {@code ACLDefinition} objects.
     */
-   private Set<ACLEntry> getEntries(ACLDefinition definition, List<String> visitedACLs)
+   private Set<ACLEntry> getEntries(ACLBaseDefinition definition, List<String> visitedACLs)
    {
       if (visitedACLs.contains(definition.getResource()))
          throw new RuntimeException("Circular dependency between ACLs has been detected");
@@ -104,7 +104,7 @@
       visitedACLs.add(definition.getResource());
       if (definition.getBaseResource() != null)
       {
-         ACLDefinition superDefinition = this.definitions.get(definition.getBaseResource());
+         ACLBaseDefinition superDefinition = this.definitions.get(definition.getBaseResource());
          if (superDefinition != null)
          {
             Set<ACLEntry> superEntries = this.getEntries(superDefinition, visitedACLs);

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLConfigurationFactory.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -24,11 +24,6 @@
 import java.io.InputStream;
 
 import org.jboss.logging.Logger;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
 
 /**
  * <p>
@@ -39,11 +34,31 @@
  */
 public class ACLConfigurationFactory
 {
-
-   private static final String schemaName = "schema/jboss-acl-config_1_0.xsd";
-
    private static Logger log = Logger.getLogger(ACLConfigurationFactory.class);
 
+   private static ACLConfigParser aclParser = null;
+   
+   static 
+   {
+     //Let us try the JBossXB Parser if available
+     String className = "org.jboss.security.acl.config.ACLConfigParserJBossXB";
+     try
+     {
+        ClassLoader tcl = SecurityActions.getContextClassLoader();
+        Class<?> clazz = tcl.loadClass(className);
+        aclParser = (ACLConfigParser) clazz.newInstance(); 
+     }
+     catch(Exception e)
+     {
+        if(log.isTraceEnabled())
+        {
+           log.trace("Exception initializing ACL Config Parser based on JBossXB", e);
+        }
+        //Fallback to general stax based parser
+        aclParser = new ACLConfigParserStax();
+     }
+   }
+   
    /**
     * <p>
     * Creates and return an {@code ACLConfiguration} object using the specified input stream to read the ACL
@@ -55,18 +70,17 @@
     */
    public static ACLConfiguration getConfiguration(InputStream aclConfigFileStream)
    {
-      ClassLoader tcl = SecurityActions.getContextClassLoader();
-      SchemaBinding schema = XsdBinder.bind(tcl.getResourceAsStream(schemaName), null);
-      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
-      try
-      {
-         ACLConfiguration configuration = (ACLConfiguration) unmarshaller.unmarshal(aclConfigFileStream, schema);
-         return configuration;
-      }
-      catch (JBossXBException e)
-      {
-         log.debug("Error parsing ACL configuration file", e);
-         throw new RuntimeException(e);
-      }
+      if(aclParser == null)
+         throw new IllegalStateException("ACL Config Parser is null");
+      return aclParser.getConfiguration(aclConfigFileStream); 
    }
-}
+   
+   /**
+    * Set a new {@code ACLConfigParser}
+    * @param aclParserPassed
+    */
+   public static void setConfigParser(ACLConfigParser aclParserPassed)
+   {
+      aclParser = aclParserPassed; 
+   }
+}
\ No newline at end of file

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/acl/config/ACLDefinition.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -21,13 +21,9 @@
  */
 package org.jboss.security.acl.config;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import javax.xml.namespace.QName;
 
 import org.jboss.logging.Logger;
-import org.jboss.security.acl.ACLEntry;
 import org.jboss.xb.binding.GenericValueContainer;
 
 /**
@@ -37,17 +33,11 @@
  * 
  * @author <a href="mailto:sguilhen at redhat.com">Stefan Guilhen</a>
  */
-public class ACLDefinition implements GenericValueContainer
+public class ACLDefinition extends ACLBaseDefinition implements GenericValueContainer
 {
 
-   private static Logger logger = Logger.getLogger(ACLDefinition.class);
+   private static Logger logger = Logger.getLogger(ACLDefinition.class); 
 
-   private String resource;
-
-   private String baseResource;
-
-   private final Set<ACLEntry> entries = new HashSet<ACLEntry>();
-
    /*
     * (non-Javadoc)
     * 
@@ -85,61 +75,8 @@
    public Class<?> getTargetClass()
    {
       return ACLDefinition.class;
-   }
+   }   
 
-   /**
-    * <p>
-    * Adds a parsed {@code ACLEntry} to the list of entries of this {@code ACLDefinition}.
-    * </p>
-    * 
-    * @param entry the {@code ACLEntry} to be added.
-    */
-   public void addACLEntry(Object entry)
-   {
-      logger.debug("addEntry: " + entry);
-
-      if (entry instanceof ACLEntry)
-         this.entries.add((ACLEntry) entry);
-   }
-
-   /**
-    * <p>
-    * Obtains the configured {@code <acl-definition>} resource.
-    * </p>
-    * 
-    * @return a {@code String} containing the resource as configured in the XML file.
-    */
-   public String getResource()
-   {
-      return resource;
-   }
-
-   /**
-    * <p>
-    * Obtains the configured {@code <acl-definition>} base-resource, as per the {@code extends} attribute in the XML
-    * file.
-    * </p>
-    * 
-    * @return a {@code String} containing the base-resource as configured in the XML file, or {@code null} if no base
-    *         resource is available.
-    */
-   public String getBaseResource()
-   {
-      return baseResource;
-   }
-
-   /**
-    * <p>
-    * Obtains the ACL entries that have been configured in this ACL definition.
-    * </p>
-    * 
-    * @return a {@code List<ACLEntry>} containing the configured entries.
-    */
-   public Set<ACLEntry> getEntries()
-   {
-      return entries;
-   }
-
    /*
     * (non-Javadoc)
     * 

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DecodeAction.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -28,8 +28,7 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import org.jboss.crypto.CryptoUtil;
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
 
 /**
  * PriviledgedActions used by login modules for decoding passwords

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/mapping/providers/attribute/MappingProvidersDecodeAction.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -28,7 +28,8 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.util.MBeanServerLocator;
+ 
 
 /**
  * PriviledgedActions used by login modules for decoding passwords

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/JBossPolicyRegistration.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -174,6 +174,8 @@
       else if (PolicyRegistration.ACL.equalsIgnoreCase(type))
       {
          ACLConfiguration configuration = ACLConfigurationFactory.getConfiguration(stream);
+         if(configuration == null)
+            throw new IllegalStateException("ACL Configuration is null");
          Set<ACL> configuredACLs = configuration.getConfiguredACLs();
          // register the configured ACLs
          this.contextIDToACLs.put(contextID, configuredACLs);

Added: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	                        (rev 0)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/util/MBeanServerLocator.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -0,0 +1,124 @@
+/*
+ * 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.security.util;
+
+import java.util.Iterator;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+/**
+ * A helper class to locate an MBeanServer.
+ *      
+ * MBeanServer lookup strategy enhanced to allow the explicit
+ * setting of a particular instance to be returned. This is needed to
+ * allow re-using the jdk5 ManagementFactory.getPlatformMBeanServer()
+ * as our main MBeanServer. The DefaultDomain name of this server cannot
+ * be set, and it seems to be "null" by default (probably a bug).
+ *
+ * @author <a href="mailto:jason at planet57.com">Jason Dillon</a>
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a> 
+ * @version $Revision: 57200 $
+ */
+public class MBeanServerLocator
+{
+   /** The MBeanServer to return, if set */
+   private static MBeanServer instance = null;
+   
+   /**
+    * Private CTOR to disable instantiation
+    */
+   private MBeanServerLocator()
+   {
+      // empty
+   }   
+
+   /**
+    * Optionally set the MBeanServer to be returned
+    * by calls to locateJBoss(). Setting this back
+    * to null reverts to the normal lookup strategy.
+    * 
+    * @param server the main jboss MBeanServer or null
+    */
+   public static void setJBoss(MBeanServer server)
+   {
+      synchronized (MBeanServerLocator.class)
+      {
+         instance = server;
+      }
+   }
+   
+   /**
+    * Returns the first MBeanServer registered under the agentID
+    * 
+    * @param agentID the id of the MBeanServer to look for
+    * @return the first MBeanServer with an agentID
+    */
+   public static MBeanServer locate(final String agentID)
+   {
+      MBeanServer server = (MBeanServer)
+         MBeanServerFactory.findMBeanServer(agentID).iterator().next();
+
+      return server;
+   }
+
+   /**
+    * Returns the first available MBeanServer
+    * 
+    * @return the first available MBeanServer
+    */
+   public static MBeanServer locate()
+   {
+      return locate(null);
+   }
+
+   /**
+    * Returns the main jboss MBeanServer.
+    * 
+    * If there is one set using setJBoss(), it will be returned.
+    * Otherwise the strategy is to return the first MBeanServer
+    * registered under the "jboss" id (or else, default domain name)
+    * 
+    * @return the main jboss MBeanServer
+    * @throws IllegalStateException when no MBeanServer can be found
+    */
+   public static MBeanServer locateJBoss()
+   {
+      synchronized (MBeanServerLocator.class)
+      {
+         if (instance != null)
+         {
+            return instance;
+         }
+      }      
+      for (Iterator<?> i = MBeanServerFactory.findMBeanServer(null).iterator(); i.hasNext(); )
+      {
+         MBeanServer server = (MBeanServer) i.next();
+         if (server.getDefaultDomain().equals("jboss"))
+         {
+            return server;
+         }
+      }
+      throw new IllegalStateException("No 'jboss' MBeanServer found!");
+   }   
+}

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/acl/JBossAuthorizationManagerACLUnitTestCase.java
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/acl/JBossAuthorizationManagerACLUnitTestCase.java	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx/src/test/java/org/jboss/test/authorization/acl/JBossAuthorizationManagerACLUnitTestCase.java	2010-01-21 22:30:26 UTC (rev 99786)
@@ -21,6 +21,7 @@
  */
 package org.jboss.test.authorization.acl;
 
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -68,7 +69,9 @@
       // register an ACL policy containing ACL definitions with the PolicyRegistration.
       PolicyRegistration registration = new JBossPolicyRegistration();
       ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-      registration.registerPolicy("ID", PolicyRegistration.ACL, tcl.getResourceAsStream("config/jboss-acl.xml"));
+      InputStream aclStream = tcl.getResourceAsStream("config/jboss-acl.xml");
+      assertNotNull("ACL Config Stream is null", aclStream);
+      registration.registerPolicy("ID", PolicyRegistration.ACL, aclStream);
 
       // create an application policy that contains an ACL configuration.
       ApplicationPolicy ap = new ApplicationPolicy("test-acl");

Modified: projects/security/picketbox/fresh/security-jboss-sx/jbosssx-mc-int/pom.xml
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/jbosssx-mc-int/pom.xml	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/jbosssx-mc-int/pom.xml	2010-01-21 22:30:26 UTC (rev 99786)
@@ -1,9 +1,9 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  
   <parent>
     <groupId>org.jboss.security</groupId>
     <artifactId>jbosssx-parent</artifactId>
     <version>2.1.0.20091223-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>jbosssx-mc-int</artifactId>
@@ -21,13 +21,30 @@
     </dependency>
     <dependency>
       <groupId>org.jboss.security</groupId>
-      <artifactId>jboss-security-spi</artifactId>
+      <artifactId>jboss-security-spi-bare</artifactId>
+      <version>${project.version}</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
+      <groupId>org.jboss.security</groupId>
+      <artifactId>acl-spi</artifactId>
+      <version>${project.version}</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.security</groupId>
+      <artifactId>identity-spi</artifactId>
+      <version>${project.version}</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-kernel</artifactId>
-      <version>2.0.6.GA</version>
+      <version>2.0.9.GA</version>
       <scope>compile</scope>
       <exclusions>
         <exclusion>
@@ -39,7 +56,7 @@
     <dependency>
       <groupId>org.jboss.microcontainer</groupId>
       <artifactId>jboss-dependency</artifactId>
-      <version>2.0.6.GA</version>
+      <version>2.0.9.GA</version>
       <scope>runtime</scope>
       <exclusions>
         <exclusion>

Modified: projects/security/picketbox/fresh/security-jboss-sx/parent/pom.xml
===================================================================
--- projects/security/picketbox/fresh/security-jboss-sx/parent/pom.xml	2010-01-21 21:56:03 UTC (rev 99785)
+++ projects/security/picketbox/fresh/security-jboss-sx/parent/pom.xml	2010-01-21 22:30:26 UTC (rev 99786)
@@ -87,10 +87,10 @@
   <dependencyManagement>
     <dependencies>
       <dependency>
-        <groupId>jboss</groupId>
-        <artifactId>jboss-logging-log4j</artifactId>
-        <version>2.0.2.GA</version>
-        <scope>runtime</scope>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>2.1.1.GA</version>
+        <scope>compile</scope>
       </dependency>
       <dependency>
          <groupId>org.jboss</groupId>
@@ -111,12 +111,6 @@
          <scope>compile</scope>
       </dependency>
       <dependency>
-         <groupId>org.jboss.security</groupId>
-         <artifactId>jboss-security-spi</artifactId>
-         <version>${org.jboss.security.spi.version}</version>
-         <scope>compile</scope>
-      </dependency>
-      <dependency>
          <groupId>stax</groupId>
          <artifactId>stax-api</artifactId>
          <version>1.0.1</version>




More information about the jboss-cvs-commits mailing list