[jboss-cvs] JBossAS SVN: r107923 - in projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml: locators/cache and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 31 13:59:40 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-08-31 13:59:40 -0400 (Tue, 31 Aug 2010)
New Revision: 107923

Modified:
   projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/attrib/StorageAttributeLocator.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/cache/DecisionCacheLocator.java
   projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java
Log:
SECURITY-456: file system based attribute locator

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/attrib/StorageAttributeLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/attrib/StorageAttributeLocator.java	2010-08-31 17:58:54 UTC (rev 107922)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/attrib/StorageAttributeLocator.java	2010-08-31 17:59:40 UTC (rev 107923)
@@ -25,10 +25,14 @@
 import java.net.URISyntaxException;
 
 import org.jboss.security.xacml.locators.AttributeLocator;
-import org.jboss.security.xacml.sunxacml.EvaluationCtx;
+import org.jboss.security.xacml.sunxacml.EvaluationCtx; 
 
 /**
  * Common base class for attribute locators using external storage
+ * 
+ * All subclasses have to override and implement the
+ *  {@link #findAttribute(URI, URI, URI, URI, EvaluationCtx, int)} method
+ *  
  * @author Anil.Saldhana at redhat.com
  * @since Aug 25, 2010
  */
@@ -59,5 +63,14 @@
       this.designatorTypes.add(Integer.valueOf(2));
    }  
    
+   /**
+    * For locators based on DB or LDAP, we may need one value that needs to be substituted in the DB prepared
+    * statement or ldap DIT query.  This value for example, can be the uid
+    * 
+    * @param attributeType
+    * @param context
+    * @return
+    * @throws URISyntaxException
+    */
    protected abstract Object getSubstituteValue( URI attributeType, EvaluationCtx context ) throws URISyntaxException;
 }
\ No newline at end of file

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/cache/DecisionCacheLocator.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/cache/DecisionCacheLocator.java	2010-08-31 17:58:54 UTC (rev 107922)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/locators/cache/DecisionCacheLocator.java	2010-08-31 17:59:40 UTC (rev 107923)
@@ -24,8 +24,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.StringTokenizer;
+import java.util.List; 
 import java.util.WeakHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -35,7 +34,9 @@
 import org.jboss.security.xacml.sunxacml.ctx.ResponseCtx;
 import org.jboss.security.xacml.sunxacml.ctx.Subject;
 
+import static org.jboss.security.xacml.util.JBossXACMLUtil.getTokenList;
 
+
 /**
  * A Cache that stores decisions made on requests.
  * 
@@ -228,30 +229,9 @@
       
       return DecisionCacheLocatorRequest.from( request, 
             subjectID, resourceID, actionID, envID ); 
-   }
+   } 
    
    /**
-    * Get a list of token from comma separated string
-    * @param commaSeparatedListOfStrings
-    * @return
-    */
-   private List<String> getTokenList( String commaSeparatedListOfStrings )
-   {
-      List<String> stringList = new ArrayList<String>();
-      
-      if( commaSeparatedListOfStrings != null )
-      {  
-         StringTokenizer st = new StringTokenizer(commaSeparatedListOfStrings, ",");
-         
-         while( st != null && st.hasMoreTokens() )
-         {
-            stringList.add( st.nextToken() ); 
-         } 
-      }
-      return stringList;
-   }
-   
-   /**
     * Determine whether we need correctness (WeakHashMap)  or Speed (LinkedHashMap)
     * @return
     */

Modified: projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java	2010-08-31 17:58:54 UTC (rev 107922)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java	2010-08-31 17:59:40 UTC (rev 107923)
@@ -23,7 +23,10 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+import java.util.StringTokenizer;
 
 import org.jboss.security.xacml.factories.RequestResponseContextFactory;
 import org.jboss.security.xacml.interfaces.ResponseContext;
@@ -98,4 +101,25 @@
       
       throw new RuntimeException("unrecognized attribute value:" + value); 
    }
+   
+   /**
+    * Get a list of token from comma separated string
+    * @param commaSeparatedListOfStrings
+    * @return
+    */
+   public static List<String> getTokenList( String commaSeparatedListOfStrings )
+   {
+      List<String> stringList = new ArrayList<String>();
+      
+      if( commaSeparatedListOfStrings != null )
+      {  
+         StringTokenizer st = new StringTokenizer(commaSeparatedListOfStrings, ",");
+         
+         while( st != null && st.hasMoreTokens() )
+         {
+            stringList.add( st.nextToken() ); 
+         } 
+      }
+      return stringList;
+   }
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list