portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlest...@apache.org
Subject svn commit: r331065 [1/2] - in /portals/jetspeed-2/trunk: commons/src/java/org/apache/jetspeed/util/ commons/src/test/org/apache/jetspeed/util/ components/page-manager/src/java/org/apache/jetspeed/om/page/psml/ components/portal/src/java/org/apache/jet...
Date Sun, 06 Nov 2005 03:40:54 GMT
Author: dlestrat
Date: Sat Nov  5 19:40:32 2005
New Revision: 331065

URL: http://svn.apache.org/viewcvs?rev=331065&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-188#action_12356329

Revisited the LDAP implementation.  Integrate Apache DS with J2.
All unit tests for LDAP are passing on Apache DS.  Leave them excluded for now.
Various quick fixes for serializable objects.  Add serialUID.

Documentation to come in the next few days.

Added:
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/InitLdapSchema.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapBindingConfig.java
Removed:
    portals/jetspeed-2/trunk/components/security/etc/ldap.properties
Modified:
    portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/util/Path.java
    portals/jetspeed-2/trunk/commons/src/test/org/apache/jetspeed/util/TestPathUtil.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestRenderer.java
    portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
    portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap-atn.xml
    portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap.xml
    portals/jetspeed-2/trunk/components/security/maven.xml
    portals/jetspeed-2/trunk/components/security/project.properties
    portals/jetspeed-2/trunk/components/security/project.xml
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalCredentialImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPermissionImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/CredentialHandler.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/AbstractLdapDao.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapGroupDaoImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDao.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDaoImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapUserCredentialDao.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapUserCredentialDaoImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapUserPrincipalDao.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapUserPrincipalDaoImpl.java

Modified: portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/util/Path.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/util/Path.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/util/Path.java (original)
+++ portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/util/Path.java Sat Nov  5 19:40:32 2005
@@ -23,49 +23,44 @@
 /**
  * <h2>Overview</h2>
  * <p>
- * The Path object is used to standard used to standardize the creation of
- * mutation of path-like structures. For: example /foo/bar/index.html.
+ * The Path object is used to standard used to standardize the creation of mutation of path-like
+ * structures. For: example /foo/bar/index.html.
  * </p>
- * 
  * <h2>Rules for Interperting Pathes</h2>
  * <p>
- * Below are the rules for how the constructor interprets literal paths.
- * <strong>NOTE</strong> the {@link addSegment(String)} interprets string
- * pathes in a somewhat different manner. <table>
+ * Below are the rules for how the constructor interprets literal paths. <strong>NOTE</strong> the
+ * {@link addSegment(String)} interprets string pathes in a somewhat different manner. <table>
  * <tr>
  * <th>Literal Path</th>
  * <th>Interpretation</th>
  * </tr>
  * <td> <i>/foo/bar/index.html</i> </td>
- * <td> <code>foo</code> and <code>bar</code> will be considered directory
- * segments while <code>index.html</code> will be considered a file segment.
- * This means that the <code>baseName</code> will be set to <i>index</i> and
- * the <code>fileExtension</code> will be set to <i>.html</i> </td>
+ * <td> <code>foo</code> and <code>bar</code> will be considered directory segments while
+ * <code>index.html</code> will be considered a file segment. This means that the
+ * <code>baseName</code> will be set to <i>index</i> and the <code>fileExtension</code> will be
+ * set to <i>.html</i> </td>
  * <tr>
- * <td> <i>/foo/bar/</i>, <i>/foo/bar</i>, <i>foo/bar/</i> <i>foo/bar</i>
- * </td>
+ * <td> <i>/foo/bar/</i>, <i>/foo/bar</i>, <i>foo/bar/</i> <i>foo/bar</i> </td>
  * <td>
  * <p>
- * <code>foo</code> and <code>bar</code> will be considered directory
- * segments. <code>baseName</code> and <code>fileExtension</code> will be
- * left as <code>null</code>.
+ * <code>foo</code> and <code>bar</code> will be considered directory segments.
+ * <code>baseName</code> and <code>fileExtension</code> will be left as <code>null</code>.
  * <p>
- * I cases where a file has no extension you must use the
- * {@link setFileSegment(String))} to manually set the file. This causes the
- * <code>baseName</code> to be set to the file name specified and the
- * <code>fileExtension</code> will be set to the empty string ("").
+ * I cases where a file has no extension you must use the {@link setFileSegment(String))} to
+ * manually set the file. This causes the <code>baseName</code> to be set to the file name
+ * specified and the <code>fileExtension</code> will be set to the empty string ("").
  * </p>
  * </td>
  * </tr>
  * </table>
  * 
- * 
- * 
  * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
- * 
  */
 public class Path implements Serializable, Cloneable
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = 6890966283704092945L;
+
     public static final String PATH_SEPERATOR = "/";
 
     private String path;
@@ -91,10 +86,10 @@
     {
         this.segments = new LinkedList();
         this.path = path.replace('\\', '/');
-        
-        if(!this.path.startsWith("/"))
+
+        if (!this.path.startsWith("/"))
         {
-            this.path ="/"+this.path;
+            this.path = "/" + this.path;
         }
 
         parsePathSegments(segments, this.path, false);
@@ -165,7 +160,7 @@
         }
         else
         {
-            // File segement must have been removed
+            // File segment must have been removed
             fileName = null;
             baseName = null;
             fileExtension = null;
@@ -177,11 +172,9 @@
     /**
      * Returns the segement of the path at the specified index <code>i</code>.
      * 
-     * @param i
-     *            index containing the segment to return.
+     * @param i index containing the segment to return.
      * @return Segment at index <code>i</code>
-     * @throws ArrayIndexOutOfBoundsException
-     *             if the index is not within the bounds of this Path.
+     * @throws ArrayIndexOutOfBoundsException if the index is not within the bounds of this Path.
      */
     public String getSegment(int i)
     {
@@ -190,14 +183,12 @@
 
     /**
      * <p>
-     * Adds this segment to the end of the path but before the current file
-     * segment, if one exists. For consistency Segments added via this method
-     * are <strong>ALWAYS</strong> considered directories even when matching a
-     * standrad file pattern i.e. <i>index.html</i>
+     * Adds this segment to the end of the path but before the current file segment, if one exists.
+     * For consistency Segments added via this method are <strong>ALWAYS</strong> considered
+     * directories even when matching a standrad file pattern i.e. <i>index.html</i>
      * </p>
      * <p>
-     * If you need to set the file segment, please use the setFileSegment()
-     * method.
+     * If you need to set the file segment, please use the setFileSegment() method.
      * </p>
      * 
      * @param segment
@@ -226,9 +217,9 @@
 
     public Path getSubPath(int beginAtSegment)
     {
-       return getSubPath(beginAtSegment, segments.size());
+        return getSubPath(beginAtSegment, segments.size());
     }
-    
+
     public Path getSubPath(int beginAtSegment, int endSegment)
     {
         StringBuffer newPathString = new StringBuffer();
@@ -355,9 +346,8 @@
     }
 
     /**
-     * Removes the last directory segment in this path. This method <strong>WILL
-     * NOT</strong> remove the fileSegment, but path segment immediately before
-     * it.
+     * Removes the last directory segment in this path. This method <strong>WILL NOT</strong>
+     * remove the fileSegment, but path segment immediately before it.
      * 
      * @return segment removed.
      */
@@ -423,10 +413,10 @@
         }
         rebuildPath();
     }
-    
+
     public Path getChild(String childPath)
     {
-        if(fileName != null)
+        if (fileName != null)
         {
             return getSubPath(0, (segments.size() - 1)).addSegment(childPath);
         }
@@ -434,38 +424,38 @@
         {
             return getSubPath(0, segments.size()).addSegment(childPath);
         }
-        
+
     }
-    
+
     public Path getChild(Path childPath)
     {
         Path child = null;
-        if(fileName != null)
+        if (fileName != null)
         {
             child = getSubPath(0, (segments.size() - 1));
-            
+
         }
         else
         {
             child = getSubPath(0, segments.size());
         }
-        
+
         child.addSegment(childPath.toString());
-        return child;        
+        return child;
     }
-    
+
     public Path getParent()
     {
-        if(fileName != null)
+        if (fileName != null)
         {
-            
-           return getSubPath(0, segments.size()-1);       
+
+            return getSubPath(0, segments.size() - 1);
         }
         else
         {
-            if(segments.size() > 1)
+            if (segments.size() > 1)
             {
-                return getSubPath(0, segments.size()-1);
+                return getSubPath(0, segments.size() - 1);
             }
             else
             {

Modified: portals/jetspeed-2/trunk/commons/src/test/org/apache/jetspeed/util/TestPathUtil.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/commons/src/test/org/apache/jetspeed/util/TestPathUtil.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/test/org/apache/jetspeed/util/TestPathUtil.java (original)
+++ portals/jetspeed-2/trunk/commons/src/test/org/apache/jetspeed/util/TestPathUtil.java Sat Nov  5 19:40:32 2005
@@ -54,7 +54,7 @@
         
         path = new Path("file");
         
-        assertEquals("file", path.getBaseName());
+        assertNull(path.getBaseName());
         
         Path pathNoFile = new Path("/root/sub1/sub2");
         assertEquals("root", pathNoFile.getSegment(0));

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java Sat Nov  5 19:40:32 2005
@@ -23,8 +23,6 @@
 import java.util.Map;
 import java.util.Vector;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.om.page.Fragment;
 
 /**
@@ -51,8 +49,11 @@
 
     private String name;
 
-    private static final Log log = LogFactory.getLog(FragmentImpl.class);
-
+    /**
+     * <p>
+     * Default Constructor.
+     * </p>
+     */
     public FragmentImpl()
     {
     }
@@ -112,7 +113,7 @@
         return (Vector) this.propertiesList;
             }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
      */
     public String getProperty(String propName)
@@ -120,7 +121,7 @@
         return (String)propertiesMap.get(propName);
         }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String,java.lang.String)
      */
     public int getIntProperty(String propName)
@@ -133,7 +134,7 @@
         return -1;
         }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getProperties()
      */
     public Map getProperties()
@@ -141,7 +142,7 @@
         return propertiesMap;
             }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
      */
     public int getLayoutRow()
@@ -154,7 +155,7 @@
         return -1;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
      */
     public void setLayoutRow(int row)
@@ -169,7 +170,7 @@
             }
         }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
      */
     public int getLayoutColumn()
@@ -182,7 +183,7 @@
         return -1;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
      */
     public void setLayoutColumn(int column)
@@ -197,7 +198,7 @@
             }
         }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
      */
     public String getLayoutSizes()
@@ -205,7 +206,7 @@
         return (String)propertiesMap.get(SIZES_PROPERTY_NAME);
             }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
      */
     public void setLayoutSizes(String sizes)

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java Sat Nov  5 19:40:32 2005
@@ -232,8 +232,7 @@
             FailedToRenderFragmentException, PortletEntityNotStoredException
     {
         ContentDispatcher dispatcher = null;
-        RenderingJob rJob;
-
+        
         PortletWindow portletWindow = getPortletWindow(fragment);
         ContentDispatcherCtrl dispatcherCtrl = getDispatcherCtrl(requestContext, true);
         dispatcher = getDispatcher(requestContext, true);        

Modified: portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestRenderer.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestRenderer.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestRenderer.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestRenderer.java Sat Nov  5 19:40:32 2005
@@ -21,6 +21,7 @@
 import org.apache.jetspeed.AbstractPortalContainerTestCase;
 import org.apache.jetspeed.aggregator.impl.PortletRendererImpl;
 import org.apache.jetspeed.aggregator.impl.WorkerMonitorImpl;
+import org.apache.jetspeed.statistics.impl.PortalStatisticsImpl;
 
 /**
  * TestPortletRenderer
@@ -49,7 +50,7 @@
         WorkerMonitor monitor = new WorkerMonitorImpl(5, 20, 5, 10);
         monitor.start();
         
-        renderer = new PortletRendererImpl(portletContainer, windowAccessor, monitor);       
+        renderer = new PortletRendererImpl(portletContainer, windowAccessor, monitor, new PortalStatisticsImpl());       
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java (original)
+++ portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java Sat Nov  5 19:40:32 2005
@@ -20,6 +20,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.prefs.Preferences;
 
 import org.apache.jetspeed.aggregator.PortletContent;
@@ -33,7 +34,6 @@
 import org.apache.jetspeed.om.common.preference.PreferenceSetComposite;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.Fragment;
-import org.apache.jetspeed.om.page.Property;
 import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
 import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
 import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
@@ -75,14 +75,6 @@
         }
 
         /**
-         * @param p
-         */
-        public void addProperty(Property p)
-        {
-            f.addProperty(p);
-        }
-
-        /**
          * @param actions
          * @throws SecurityException
          */
@@ -109,17 +101,7 @@
             f.checkPermissions(actions);
         }
 
-        /**
-         * @param layoutName
-         */
-        public void clearProperties(String layoutName)
-        {
-            f.clearProperties(layoutName);
-        }
-
-        /*
-         * (non-Javadoc)
-         * 
+        /** 
          * @see java.lang.Object#equals(java.lang.Object)
          */
         public boolean equals(Object obj)
@@ -162,14 +144,6 @@
         /**
          * @return
          */
-        public List getLayoutProperties()
-        {
-            return f.getLayoutProperties();
-        }
-
-        /**
-         * @return
-         */
         public String getName()
         {
             return f.getName();
@@ -183,24 +157,6 @@
             return f.getPermissionsEnabled();
         }
 
-        /**
-         * @param layoutName
-         * @return
-         */
-        public List getProperties(String layoutName)
-        {
-            return f.getProperties(layoutName);
-        }
-
-        /**
-         * @param layout
-         * @param propName
-         * @return
-         */
-        public String getPropertyValue(String layout, String propName)
-        {
-            return f.getPropertyValue(layout, propName);
-        }
 
         /**
          * @return
@@ -267,14 +223,6 @@
         }
 
         /**
-         * @param p
-         */
-        public void removeProperty(Property p)
-        {
-            f.removeProperty(p);
-        }
-
-        /**
          * @param decoratorName
          */
         public void setDecorator(String decoratorName)
@@ -291,16 +239,6 @@
         }
 
         /**
-         * @param layout
-         * @param propName
-         * @param value
-         */
-        public void setPropertyValue(String layout, String propName, String value)
-        {
-            f.setPropertyValue(layout, propName, value);
-        }
-
-        /**
          * @param constraints
          */
         public void setSecurityConstraints(SecurityConstraints constraints)
@@ -366,7 +304,6 @@
          */
         public List getContentFragments()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
@@ -375,7 +312,6 @@
          */
         public String getRenderedContent() throws IllegalStateException
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
@@ -384,8 +320,6 @@
          */
         public void overrideRenderedContent(String contnent)
         {
-            // TODO Auto-generated method stub
-
         }
 
         /** 
@@ -393,8 +327,6 @@
          */
         public void setPortletContent(PortletContent portletContent)
         {
-            // TODO Auto-generated method stub
-
         }
 
         /**
@@ -402,7 +334,6 @@
          */
         public int getLayoutColumn()
         {
-            // TODO Auto-generated method stub
             return 0;
         }
 
@@ -411,7 +342,6 @@
          */
         public int getLayoutRow()
         {
-            // TODO Auto-generated method stub
             return 0;
         }
 
@@ -420,7 +350,6 @@
          */
         public String getLayoutSizes()
         {
-            // TODO Auto-generated method stub
             return null;
         }
 
@@ -428,30 +357,54 @@
          * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
          */
         public void setLayoutColumn(int column)
-        {
-            // TODO Auto-generated method stub
-            
+        {            
         }
 
         /**
          * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
          */
         public void setLayoutRow(int row)
-        {
-            // TODO Auto-generated method stub
-            
+        {            
         }
 
         /**
          * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
          */
         public void setLayoutSizes(String sizes)
+        {            
+        }
+
+        /**
+         * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
+         */
+        public int getIntProperty(String propName)
+        {
+            return 0;
+        }
+
+        /**
+         * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
+         */
+        public List getPreferences()
+        {
+            return null;
+        }
+
+        /**
+         * @see org.apache.jetspeed.om.page.Fragment#getProperties()
+         */
+        public Map getProperties()
         {
-            // TODO Auto-generated method stub
-            
+            return null;
         }
-        
-        
+
+        /**
+         * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
+         */
+        public String getProperty(String propName)
+        {
+            return null;
+        }        
     }
 
     private static final String TEST_APP = "EntityTestApp";

Modified: portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap-atn.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap-atn.xml?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap-atn.xml (original)
+++ portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap-atn.xml Sat Nov  5 19:40:32 2005
@@ -22,11 +22,14 @@
   <bean id="org.apache.jetspeed.security.spi.impl.ldap.LdapUserCredentialDao" 
        class="org.apache.jetspeed.security.spi.impl.ldap.LdapUserCredentialDaoImpl"
   >       
-       <constructor-arg index="0"><value>${org.apache.jetspeed.ldap.ldapServerName}</value></constructor-arg>       
-       <constructor-arg index="1"><value>${org.apache.jetspeed.ldap.rootDn}</value></constructor-arg>       
-       <constructor-arg index="2"><value>${org.apache.jetspeed.ldap.rootPassword}</value></constructor-arg>
-       <constructor-arg index="3"><value>${org.apache.jetspeed.ldap.rootContext}</value></constructor-arg>  
-       <constructor-arg index="4"><value>${org.apache.jetspeed.ldap.defaultDnSuffix}</value></constructor-arg>        
+       <constructor-arg index="0"><ref bean="org.apache.jetspeed.security.spi.impl.ldap.LdapBindingConfig"/></constructor-arg>       
+  </bean>
+  
+  <!-- Security SPI: LdapPrincipalDao -->
+  <bean id="org.apache.jetspeed.security.spi.impl.ldap.LdapUserPrincipalDao" 
+       class="org.apache.jetspeed.security.spi.impl.ldap.LdapUserPrincipalDaoImpl"
+  >       
+       <constructor-arg index="0"><ref bean="org.apache.jetspeed.security.spi.impl.ldap.LdapBindingConfig"/></constructor-arg>       
   </bean>
   
   <!-- Security SPI: CredentialHandler -->
@@ -40,7 +43,7 @@
   <bean id="org.apache.jetspeed.security.spi.UserSecurityHandler" 
   	   class="org.apache.jetspeed.security.spi.impl.ldap.LdapUserSecurityHandler"
   >  	   
-  	   <constructor-arg ><ref bean="org.apache.jetspeed.security.spi.impl.ldap.LdapUserCredentialDao"/></constructor-arg> 	   
+  	   <constructor-arg ><ref bean="org.apache.jetspeed.security.spi.impl.ldap.LdapUserPrincipalDao"/></constructor-arg> 	   
   </bean>
 
 </beans>

Modified: portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap.xml?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap.xml (original)
+++ portals/jetspeed-2/trunk/components/security/etc/security-spi-ldap.xml Sat Nov  5 19:40:32 2005
@@ -20,9 +20,26 @@
   <!-- ************** Ldap Configuration ************** -->
   <!-- Adds ldap.properties as our configuration object to support ${...} vars -->
   <!-- ${applicationRoot} is acutally set as a system property via the SpringEngine -->
-  <bean id="ldapPlaceholderConfig"
-      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-    <property name="location"><value>file:///${applicationRoot}/WEB-INF/conf/ldap.properties</value></property>
+  <bean id="org.apache.jetspeed.security.spi.impl.ldap.LdapBindingConfig"
+      class="org.apache.jetspeed.security.spi.impl.ldap.LdapBindingConfig">
+      <!-- The LDAP initial context factory. -->
+      <constructor-arg index="0"><value>com.sun.jndi.ldap.LdapCtxFactory</value></constructor-arg>
+      <!-- The LDAP server name. -->
+      <constructor-arg index="1"><value>localhost</value></constructor-arg>
+      <!-- The LDAP server port. -->
+      <constructor-arg index="2"><value>10389</value></constructor-arg>
+      <!-- The LDAP server default dn suffix. -->
+      <constructor-arg index="3"><value></value></constructor-arg>
+      <!-- The LDAP server root context. -->
+      <constructor-arg index="3"><value>o=sevenSeas</value></constructor-arg>
+      <!-- The LDAP server root dn. -->
+      <constructor-arg index="3"><value>uid=admin,ou=system</value></constructor-arg>
+      <!-- The LDAP server root password. -->
+      <constructor-arg index="3"><value>secret</value></constructor-arg>
+      <!-- The users org unit. -->
+      <constructor-arg index="3"><value>users</value></constructor-arg>
+      <!-- The groups org unit. -->
+      <constructor-arg index="3"><value>groups</value></constructor-arg>
   </bean>
 
 </beans>

Modified: portals/jetspeed-2/trunk/components/security/maven.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/maven.xml?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/maven.xml (original)
+++ portals/jetspeed-2/trunk/components/security/maven.xml Sat Nov  5 19:40:32 2005
@@ -17,6 +17,6 @@
 <project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:maven="jelly:maven">
 
     <!-- Target of maven test:single test -->
-    <property name="testcase" value="org.apache.jetspeed.security.TestPermissionManager" />
+    <property name="testcase" value="org.apache.jetspeed.security.spi.ldap.TestLdapUserSecurityHandler" />
     
 </project>

Modified: portals/jetspeed-2/trunk/components/security/project.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/project.properties?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/project.properties (original)
+++ portals/jetspeed-2/trunk/components/security/project.properties Sat Nov  5 19:40:32 2005
@@ -17,4 +17,3 @@
 
 maven.multiproject.type=jar
 maven.license.licenseFile=${basedir}/../../LICENSE.TXT
-

Modified: portals/jetspeed-2/trunk/components/security/project.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/project.xml?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/project.xml (original)
+++ portals/jetspeed-2/trunk/components/security/project.xml Sat Nov  5 19:40:32 2005
@@ -77,7 +77,7 @@
             </properties>
         </dependency>
     </dependencies>
-
+    
     <build>
         <sourceDirectory>src/java</sourceDirectory>
         <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/AggregationHierarchyResolver.java Sat Nov  5 19:40:32 2005
@@ -16,8 +16,6 @@
 
 import java.util.prefs.Preferences;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.security.HierarchyResolver;
 import org.apache.jetspeed.util.ArgUtil;
 
@@ -45,8 +43,6 @@
  */
 public class AggregationHierarchyResolver extends BaseHierarchyResolver implements HierarchyResolver
 {
-    private static final Log log = LogFactory.getLog(AggregationHierarchyResolver.class);
-
     /**
      * @see org.apache.jetspeed.security.HierarchyResolver#resolve(Preferences)
      */

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupManagerImpl.java Sat Nov  5 19:40:32 2005
@@ -394,8 +394,6 @@
         ArgUtil.notNull(new Object[] { groupFullPathName }, new String[] { "groupFullPathName" },
                 "setGroupEnabled(java.lang.String,boolean)");
 
-        String fullPath = GroupPrincipalImpl.getFullPathFromPrincipalName(groupFullPathName);
-
         GroupPrincipalImpl groupPrincipal = (GroupPrincipalImpl)groupSecurityHandler.getGroupPrincipal(groupFullPathName);
         if (null == groupPrincipal)
         {

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/GroupPrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -24,6 +24,9 @@
 public class GroupPrincipalImpl extends BasePrincipalImpl implements GroupPrincipal
 {
 
+    /** The serial version uid. */
+    private static final long serialVersionUID = 6061115481776568899L;
+
     /**
      * <p>The group principal constructor.</p>
      * @param groupName The group principal name.

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/PermissionManagerImpl.java Sat Nov  5 19:40:32 2005
@@ -18,7 +18,6 @@
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.Permissions;
-import java.security.Policy;
 import java.security.Principal;
 import java.security.PrivilegedAction;
 import java.sql.Timestamp;

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RoleManagerImpl.java Sat Nov  5 19:40:32 2005
@@ -414,8 +414,6 @@
         ArgUtil.notNull(new Object[] { roleFullPathName }, new String[] { "roleFullPathName" },
         "setRoleEnabled(java.lang.String,boolean)");
 
-        String fullPath = RolePrincipalImpl.getFullPathFromPrincipalName(roleFullPathName);
-
         RolePrincipalImpl rolePrincipal = (RolePrincipalImpl)roleSecurityHandler.getRolePrincipal(roleFullPathName);
         if (null == rolePrincipal)
         {

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/RolePrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -24,6 +24,9 @@
 public class RolePrincipalImpl extends BasePrincipalImpl implements RolePrincipal
 {
 
+    /** The serial version uid. */
+    private static final long serialVersionUID = -3521731040045006314L;
+
     /**
      * <p>The role principal constructor.</p>
      * @param roleName The role principal name.

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java Sat Nov  5 19:40:32 2005
@@ -492,8 +492,6 @@
             throw new SecurityException(SecurityException.ANONYMOUS_USER_PROTECTED.create(userName));
         }
 
-        String fullPath = (new UserPrincipalImpl(userName)).getFullPath();
-
         UserPrincipalImpl userPrincipal = (UserPrincipalImpl)atnProviderProxy.getUserPrincipal(userName);
         if (null == userPrincipal) 
         { 

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserPrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -24,6 +24,9 @@
 public class UserPrincipalImpl extends BasePrincipalImpl implements UserPrincipal
 {
 
+    /** The serial version uid. */
+    private static final long serialVersionUID = 4134905654850335230L;
+
     /**
      * <p>The user principal constructor.</p>
      * @param userName The user principal name.

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalCredentialImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalCredentialImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalCredentialImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalCredentialImpl.java Sat Nov  5 19:40:32 2005
@@ -27,6 +27,9 @@
  */
 public class InternalCredentialImpl implements InternalCredential
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = -8064404995292602590L;
+
     /**
      * <p>InternalCredential implementation default constructor.</p>
      */

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalGroupPrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -25,6 +25,9 @@
  */
 public class InternalGroupPrincipalImpl extends InternalPrincipalImpl implements InternalGroupPrincipal
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = -8236429453373927824L;
+    
     /** <p>Group principal security class.</p> */
     static String GROUP_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalGroupPrincipalImpl";
 

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPermissionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPermissionImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPermissionImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPermissionImpl.java Sat Nov  5 19:40:32 2005
@@ -27,6 +27,9 @@
 public class InternalPermissionImpl implements InternalPermission
 {
 
+    /** The serial version uid. */
+    private static final long serialVersionUID = 251708679848856538L;
+
     /**
      * <p>InternalPermission implementation default constructor.</p>
      */

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalPrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -29,6 +29,9 @@
  */
 public class InternalPrincipalImpl implements InternalPrincipal
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = 3615655651128923549L;
+
     /** The principal id. */
     private long principalId;
 

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalRolePrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -25,6 +25,9 @@
  */
 public class InternalRolePrincipalImpl extends InternalPrincipalImpl implements InternalRolePrincipal
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = 4422827842052325846L;
+    
     /** <p>Role principal security class.</p> */
     static String ROLE_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalRolePrincipalImpl";
 

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/om/impl/InternalUserPrincipalImpl.java Sat Nov  5 19:40:32 2005
@@ -26,6 +26,9 @@
  */
 public class InternalUserPrincipalImpl extends InternalPrincipalImpl implements InternalUserPrincipal
 {
+    /** The serial version uid. */
+    private static final long serialVersionUID = 6713096308414915156L;
+
     /** <p>User principal security class.</p> */
     static String USER_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalUserPrincipalImpl";
     

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/CredentialHandler.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/CredentialHandler.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/CredentialHandler.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/CredentialHandler.java Sat Nov  5 19:40:32 2005
@@ -17,7 +17,6 @@
 import java.sql.Date;
 import java.util.Set;
 
-import org.apache.jetspeed.security.PasswordCredential;
 import org.apache.jetspeed.security.SecurityException;
 
 /**

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/DefaultPasswordCredentialImpl.java Sat Nov  5 19:40:32 2005
@@ -37,6 +37,9 @@
 public class DefaultPasswordCredentialImpl implements PasswordCredential, Serializable
 {
 
+    /** The default uid. */
+    private static final long serialVersionUID = -4975305752376365096L;
+
     /** The user name. */
     private String userName;
 

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapGroupSecurityHandler.java Sat Nov  5 19:40:32 2005
@@ -33,14 +33,13 @@
 
 /**
  * @see org.apache.jetspeed.security.spi.GroupSecurityHandler
- * 
- * @author <a href="mailto:mike.long@dataline.com">Mike Long </a><br/>
- *         <a href="mailto:dlestrat@apache.org">David Le Strat </a>
+ * @author <a href="mailto:mike.long@dataline.com">Mike Long </a><br/> <a
+ *         href="mailto:dlestrat@apache.org">David Le Strat </a>
  */
 public class LdapGroupSecurityHandler implements GroupSecurityHandler
 {
     /** The logger. */
-    private static final Log LOG = LogFactory.getLog(LdapGroupSecurityHandler.class);
+    private static final Log logger = LogFactory.getLog(LdapGroupSecurityHandler.class);
 
     /** The {@link LdapPrincipalDao}. */
     private LdapPrincipalDao ldap;
@@ -71,7 +70,7 @@
      */
     public Principal getGroupPrincipal(String groupPrincipalUid)
     {
-        String groupUidWithoutSlashes = convertUidToAcceptableName(groupPrincipalUid);
+        String groupUidWithoutSlashes = ldap.convertUidToLdapAcceptableName(groupPrincipalUid);
         verifyGroupId(groupUidWithoutSlashes);
         try
         {
@@ -114,9 +113,9 @@
      */
     private void logSecurityException(SecurityException e, String groupPrincipalUid)
     {
-        if (LOG.isErrorEnabled())
+        if (logger.isErrorEnabled())
         {
-            LOG.error("An LDAP error has occurred for groupId:" + groupPrincipalUid, e);
+            logger.error("An LDAP error has occurred for groupId:" + groupPrincipalUid, e);
         }
     }
 
@@ -125,16 +124,12 @@
      */
     public void setGroupPrincipal(GroupPrincipal groupPrincipal) throws SecurityException
     {
-        System.out.println("Group Principal UID:" + groupPrincipal.getFullPath());
         verifyGroupPrincipal(groupPrincipal);
 
-        String uid = groupPrincipal.getFullPath();
-        String groupUidWithoutSlashes = convertUidToAcceptableName(uid);
-        LOG.debug("Group Principal UID:" + groupUidWithoutSlashes);
-
+        String fullPath = groupPrincipal.getFullPath();
+        String groupUidWithoutSlashes = ldap.convertUidToLdapAcceptableName(fullPath);
         if (getGroupPrincipal(groupUidWithoutSlashes) == null)
         {
-            LOG.debug("Group Principal UID:" + groupUidWithoutSlashes);
             ldap.create(groupUidWithoutSlashes);
         }
 
@@ -142,19 +137,6 @@
 
     /**
      * <p>
-     * Converts the uid to an acceptable ldap name.
-     * </p>
-     * 
-     * @param uid The uid.
-     * @return The acceptable name.
-     */
-    private String convertUidToAcceptableName(String uid)
-    {
-        return uid.replaceAll("/", "&");
-    }
-
-    /**
-     * <p>
      * Verify that the group principal is valid.
      * </p>
      * 
@@ -175,8 +157,8 @@
     {
         verifyGroupPrincipal(groupPrincipal);
 
-        String uid = groupPrincipal.getFullPath();
-        String groupUidWithoutSlashes = convertUidToAcceptableName(uid);
+        String fullPath = groupPrincipal.getFullPath();
+        String groupUidWithoutSlashes = ldap.convertUidToLdapAcceptableName(fullPath);
 
         ldap.delete(groupUidWithoutSlashes);
     }
@@ -188,8 +170,7 @@
     {
         try
         {
-            String filterWithoutSlashes = convertUidToAcceptableName(filter);
-            return Arrays.asList(ldap.find(filterWithoutSlashes));
+            return Arrays.asList(ldap.find(filter, GroupPrincipal.PREFS_GROUP_ROOT));
         }
         catch (SecurityException e)
         {

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapSecurityMappingHandler.java Sat Nov  5 19:40:32 2005
@@ -277,6 +277,10 @@
     {
         UserPrincipal user = getUser(username);
         GroupPrincipal group = getGroup(groupFullPathName);
+        if ((null == user) && (null == group))
+        {
+            throw new SecurityException(SecurityException.USER_DOES_NOT_EXIST);
+        }
     }
 
     /**
@@ -318,7 +322,7 @@
      */
     private UserPrincipal getUser(String uid) throws SecurityException
     {
-        Principal[] user = userDao.find(uid);
+        Principal[] user = userDao.find(uid, UserPrincipal.PREFS_USER_ROOT);
         if (user.length == 1)
         {
             return (UserPrincipal) user[0];
@@ -336,7 +340,7 @@
      */
     private GroupPrincipal getGroup(String uid) throws SecurityException
     {
-        Principal[] group = groupDao.find(uid);
+        Principal[] group = groupDao.find(uid, GroupPrincipal.PREFS_GROUP_ROOT);
         if (group.length == 1)
         {
             return (GroupPrincipal) group[0];

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/LdapUserSecurityHandler.java Sat Nov  5 19:40:32 2005
@@ -38,7 +38,7 @@
 public class LdapUserSecurityHandler implements UserSecurityHandler
 {
     /** The logger. */
-    private static final Log LOG = LogFactory.getLog(LdapUserSecurityHandler.class);
+    private static final Log logger = LogFactory.getLog(LdapUserSecurityHandler.class);
 
     /** The {@link LdapPrincipalDao}. */
     private LdapPrincipalDao ldap;
@@ -120,9 +120,9 @@
      */
     private void logSecurityException(SecurityException se, String uid)
     {
-        if (LOG.isErrorEnabled())
+        if (logger.isErrorEnabled())
         {
-            LOG.error("An LDAP error has occurred for user uid:" + uid, se);
+            logger.error("An LDAP error has occurred for user uid:" + uid, se);
         }
     }
 
@@ -133,7 +133,7 @@
     {
         try
         {
-            return Arrays.asList(ldap.find(filter));
+            return Arrays.asList(ldap.find(filter, UserPrincipal.PREFS_USER_ROOT));
         }
         catch (SecurityException e)
         {

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/AbstractLdapDao.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/AbstractLdapDao.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/AbstractLdapDao.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/AbstractLdapDao.java Sat Nov  5 19:40:32 2005
@@ -28,6 +28,9 @@
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.security.InvalidDnException;
+import org.apache.jetspeed.security.InvalidPasswordException;
+import org.apache.jetspeed.security.InvalidUidException;
 import org.apache.jetspeed.security.SecurityException;
 
 /**
@@ -35,24 +38,13 @@
  * Abstract ldap dao.
  * </p>
  * 
- * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>
+ * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>, <a
+ *         href="mailto:dlestrat@apache.org">David Le Strat</a>
  */
 public abstract class AbstractLdapDao
 {
-    /** The ldap server name. */
-    private String ldapServerName = null;
-
-    /** The root domain. */
-    protected String rootDn = null;
-
-    /** The root password. */
-    protected String rootPassword = null;
-
-    /** The root context. */
-    protected String rootContext = null;
-
-    /** The default suffix. */
-    protected String defaultDnSuffix = null;
+    /** The ldap binding configuration. */
+    private LdapBindingConfig ldapBindingConfig = null;
 
     /** Reference to remote server context */
     protected LdapContext ctx;
@@ -64,6 +56,7 @@
      */
     public AbstractLdapDao()
     {
+        throw new UnsupportedOperationException("Must be instantiated with LDAP binding configuration.");
     }
 
     /**
@@ -71,21 +64,13 @@
      * Initializes the dao.
      * </p>
      * 
-     * @param ldapServerName The server name.
-     * @param rootDn The root domain.
-     * @param rootPassword The root password.
-     * @param rootContext The root context.
-     * @param defaultDnSuffix The default suffix.
-     */
-    public AbstractLdapDao(String ldapServerName, String rootDn, String rootPassword, String rootContext,
-            String defaultDnSuffix) throws SecurityException, NamingException
-    {
-        this.ldapServerName = ldapServerName;
-        this.rootDn = rootDn;
-        this.rootPassword = rootPassword;
-        this.rootContext = rootContext;
-        this.defaultDnSuffix = defaultDnSuffix;
-        bindToServer(rootDn, rootPassword);
+     * @param ldapConfig Holds the ldap configuration.
+     * @throws SecurityException
+     */
+    public AbstractLdapDao(LdapBindingConfig ldapConfig) throws SecurityException
+    {
+        this.ldapBindingConfig = ldapConfig;
+        bindToServer(ldapConfig.getRootDn(), ldapConfig.getRootPassword());
     }
 
     /**
@@ -95,24 +80,30 @@
      * 
      * @param rootDn
      * @param rootPassword
-     * @throws NamingException
+     * @throws SecurityException
      */
-    protected void bindToServer(String rootDn, String rootPassword) throws SecurityException,
-    		NamingException
+    protected void bindToServer(String rootDn, String rootPassword) throws SecurityException
     {
         validateDn(rootDn);
         validatePassword(rootPassword);
 
-        Properties env = new Properties();
-
-        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.PROVIDER_URL, "ldap://" + this.ldapServerName + "/" + this.rootContext);
-        env.put(Context.SECURITY_PRINCIPAL, rootDn);
-        env.put(Context.SECURITY_CREDENTIALS, rootPassword);
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        ctx = new InitialLdapContext(env, null);
+        try
+        {
+            Properties env = new Properties();
+            env.put(Context.INITIAL_CONTEXT_FACTORY, this.ldapBindingConfig.getInitialContextFactory());
+            env.put(Context.PROVIDER_URL, "ldap://" + this.ldapBindingConfig.getLdapServerName() + ":"
+                    + this.ldapBindingConfig.getLdapServerPort() + "/" + this.ldapBindingConfig.getRootContext());
+            env.put(Context.SECURITY_PRINCIPAL, rootDn);
+            env.put(Context.SECURITY_CREDENTIALS, rootPassword);
+            env.put(Context.SECURITY_AUTHENTICATION, "simple");
+            ctx = new InitialLdapContext(env, null);
+        }
+        catch (NamingException ne)
+        {
+            throw new SecurityException(ne);
+        }
     }
-    
+
     /**
      * <p>
      * Gets the sub context name.
@@ -146,11 +137,11 @@
      * 
      * @param dn The domain name.
      */
-    protected void validateDn(final String dn)
+    protected void validateDn(final String dn) throws SecurityException
     {
         if (StringUtils.isEmpty(dn))
         {
-            throw new IllegalArgumentException("The dn cannot be null or empty");
+            throw new InvalidDnException();
         }
     }
 
@@ -161,17 +152,17 @@
      * 
      * @param password The user.
      */
-    protected void validatePassword(final String password)
+    protected void validatePassword(final String password) throws SecurityException
     {
         if (StringUtils.isEmpty(password))
         {
-            throw new IllegalArgumentException("The password cannot be null or empty");
+            throw new InvalidPasswordException();
         }
     }
 
     /**
-     * @return The factors that determine the scope of the search and what gets
-     *         returned as a result of the search.
+     * @return The factors that determine the scope of the search and what gets returned as a result
+     *         of the search.
      */
     protected SearchControls setSearchControls()
     {
@@ -185,8 +176,7 @@
 
     /**
      * <p>
-     * Searches the LDAP server for the user with the specified userid (uid
-     * attribute).
+     * Searches the LDAP server for the user with the specified userid (uid attribute).
      * </p>
      * 
      * @return the user's DN
@@ -214,14 +204,13 @@
      * </p>
      * 
      * @param searchResults The {@link NamingEnumeration}.
-     * @return the user's DN of the first use in the list. Null if no users were
-     *         found.
+     * @return the user's DN of the first use in the list. Null if no users were found.
      * @throws NamingException Throws a {@link NamingException}.
      */
     private String getFirstDnForUid(NamingEnumeration searchResults) throws NamingException
     {
         String userDn = null;
-        while (searchResults.hasMore())
+        while ((null != searchResults) && searchResults.hasMore())
         {
             SearchResult searchResult = (SearchResult) searchResults.next();
 
@@ -241,12 +230,12 @@
      * 
      * @param uid The uid.
      */
-    protected void validateUid(String uid)
+    protected void validateUid(String uid) throws SecurityException
     {
-        if (StringUtils.isEmpty(uid) || uid.matches("\\(\\[\\{\\^\\$\\|\\)\\?\\*\\+\\.\\\\"))
+        String pattern = ".*\\(.*|.*\\[.*|.*\\{.*|.*\\\\.*|.*\\^.*|.*\\$.*|.*\\|.*|.*\\).*|.*\\?.*|.*\\*.*|.*\\+.*|.*\\..*";
+        if (StringUtils.isEmpty(uid) || uid.matches(pattern))
         {
-            throw new IllegalArgumentException(
-                    "The uid cannot contain any regular expression meta-characters or be null or be empty ");
+            throw new InvalidUidException();
         }
     }
 
@@ -262,10 +251,59 @@
      */
     protected NamingEnumeration searchByWildcardedUid(final String filter, SearchControls cons) throws NamingException
     {
-        NamingEnumeration searchResults = ((DirContext) ctx).search("", "(&(uid="
-                + (StringUtils.isEmpty(filter) ? "*" : filter) + ") (objectclass=" + getObjectClass() + "))", cons);
+        String searchFilter = "(&(uid=" + (StringUtils.isEmpty(filter) ? "*" : filter) + ") (objectclass="
+                + getObjectClass() + "))";
+        NamingEnumeration searchResults = ((DirContext) ctx).search("", searchFilter, cons);
 
         return searchResults;
+    }
+
+    /**
+     * <p>
+     * Returns the default suffix dn.
+     * </p>
+     * 
+     * @return The defaultDnSuffix.
+     */
+    protected String getDefaultDnSuffix()
+    {
+        return this.ldapBindingConfig.getDefaultDnSuffix();
+    }
+
+    /**
+     * <p>
+     * Returns the groups organization unit.
+     * </p>
+     * 
+     * @return The groupsOu.
+     */
+    protected String getGroupsOu()
+    {
+        return this.ldapBindingConfig.getGroupsOu();
+    }
+
+    /**
+     * <p>
+     * Returns the users organization unit.
+     * </p>
+     * 
+     * @return The usersOu.
+     */
+    protected String getUsersOu()
+    {
+        return this.ldapBindingConfig.getUsersOu();
+    }
+
+    /**
+     * <p>
+     * Returns the root context.
+     * </p>
+     * 
+     * @return The root context.
+     */
+    protected String getRootContext()
+    {
+        return this.ldapBindingConfig.getRootContext();
     }
 
     /**

Added: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/InitLdapSchema.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/InitLdapSchema.java?rev=331065&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/InitLdapSchema.java (added)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/InitLdapSchema.java Sat Nov  5 19:40:32 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.spi.impl.ldap;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.security.SecurityException;
+
+public class InitLdapSchema extends AbstractLdapDao
+{
+
+    /**
+     * <p>
+     * Default constructor.
+     * </p>
+     * 
+     * @throws SecurityException A {@link SecurityException}.
+     */
+    public InitLdapSchema() throws SecurityException
+    {
+        super();
+    }
+
+    /**
+     * <p>
+     * Initializes the LDAP schema.
+     * </p>
+     * 
+     * @param ldapConfig Holds the ldap binding configuration.
+     * @throws SecurityException A {@link SecurityException}.
+     */
+    public InitLdapSchema(LdapBindingConfig ldapConfig) throws SecurityException
+    {
+        super(ldapConfig);
+        init();
+    }
+
+    /**
+     * @see org.apache.jetspeed.security.spi.impl.ldap.AbstractLdapDao#getObjectClass()
+     */
+    protected String getObjectClass()
+    {
+        // Implementation not required for initializing the ldap schema.
+        return null;
+    }
+
+    /**
+     * @see org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDao#create(java.lang.String)
+     */
+    public void init() throws SecurityException
+    {
+        initOu(getUsersOu());
+        initOu(getGroupsOu());
+    }
+
+    /**
+     * <p>
+     * Inits a given ou.
+     * </p>
+     * 
+     * @param ou The org unit.
+     * @throws SecurityException
+     */
+    public void initOu(String ou) throws SecurityException
+    {
+        if (!StringUtils.isEmpty(ou))
+        {
+            Attributes attrs = defineLdapAttributes(ou);
+            try
+            {
+                String dn = "ou=" + ou;
+                ctx.createSubcontext(dn, attrs);
+            }
+            catch (NamingException e)
+            {
+                throw new SecurityException(e);
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * A template method for defining the attributes for a particular LDAP class.
+     * </p>
+     * 
+     * @param principalUid The principal uid.
+     * @return the LDAP attributes object for the particular class.
+     */
+    protected Attributes defineLdapAttributes(String ou)
+    {
+        Attributes attrs = new BasicAttributes(true);
+        BasicAttribute classes = new BasicAttribute("objectclass");
+
+        classes.add("top");
+        classes.add("organizationalUnit");
+        attrs.put(classes);
+        attrs.put("ou", ou);
+
+        return attrs;
+    }
+
+}

Added: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapBindingConfig.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapBindingConfig.java?rev=331065&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapBindingConfig.java (added)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapBindingConfig.java Sat Nov  5 19:40:32 2005
@@ -0,0 +1,281 @@
+/* Copyright 2004 Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.spi.impl.ldap;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.security.SecurityException;
+
+/**
+ * <p>
+ * Holds the configuration for ldap binding.
+ * </p>
+ * 
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ */
+public class LdapBindingConfig
+{
+    /** The logger. */
+    private static final Log logger = LogFactory.getLog(LdapBindingConfig.class);
+
+    /** The initial context factory for the LDAP provider. */
+    private String initialContextFactory;
+
+    /** The server name. */
+    private String ldapServerName;
+
+    /** The server port. */
+    private String ldapServerPort;
+
+    /** The root distinguished name. */
+    private String rootDn;
+
+    /** The root password. */
+    private String rootPassword;
+
+    /** The root context. */
+    private String rootContext;
+
+    /** The default suffix. */
+    private String defaultDnSuffix;
+
+    /** The users ou. */
+    private String usersOu;
+
+    /** The groups ou. */
+    private String groupsOu;
+
+    /** The ldap properties. */
+    private PropertiesConfiguration props = null;
+
+    /**
+     * @param factory The initial context factory.
+     * @param name The ldap server name.
+     * @param port The ldap server port.
+     * @param suffix The default dn suffix.
+     * @param context The root context.
+     * @param dn The root dn.
+     * @param password The root password.
+     * @param uou The users organization unit.
+     * @param gou The groups organization unit.
+     */
+    public LdapBindingConfig(String factory, String name, String port, String suffix, String context, String dn,
+            String password, String uou, String gou)
+    {
+        try
+        {
+            initialContextFactory = factory;
+            ldapServerName = name;
+            ldapServerPort = port;
+            defaultDnSuffix = suffix;
+            rootContext = context;
+            rootDn = dn;
+            rootPassword = password;
+            usersOu = uou;
+            groupsOu = gou;
+            new InitLdapSchema(this);
+        }
+        catch (SecurityException se)
+        {
+            if (logger.isWarnEnabled())
+            {
+                logger.warn("The LDAP directory should already be initialized.  If this is not the case, an exception"
+                        + "occured during initialization.");
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * Default constructor. By default instantiates LdapBindingConfig from
+     * JETSPEED-INF/ldap/ldap.properties in the classpath.
+     * </p>
+     */
+    public LdapBindingConfig()
+    {
+        try
+        {
+            props = new PropertiesConfiguration("JETSPEED-INF/ldap/ldap.properties");
+            initialContextFactory = props.getString("org.apache.jetspeed.ldap.initialContextFactory");
+            ldapServerName = props.getString("org.apache.jetspeed.ldap.ldapServerName");
+            ldapServerPort = props.getString("org.apache.jetspeed.ldap.ldapServerPort");
+            defaultDnSuffix = props.getString("org.apache.jetspeed.ldap.defaultDnSuffix");
+            rootContext = props.getString("org.apache.jetspeed.ldap.rootContext");
+            rootDn = props.getString("org.apache.jetspeed.ldap.rootDn");
+            rootPassword = props.getString("org.apache.jetspeed.ldap.rootPassword");
+            usersOu = props.getString("org.apache.jetspeed.ldap.ou.users");
+            groupsOu = props.getString("org.apache.jetspeed.ldap.ou.groups");
+            new InitLdapSchema(this);
+        }
+        catch (ConfigurationException ce)
+        {
+            logger.error("Could not configure LdapBindingConfig: " + ce);
+        }
+        catch (SecurityException se)
+        {
+            if (logger.isWarnEnabled())
+            {
+                logger.warn("The LDAP directory should already be initialized.  If this is not the case, an exception"
+                        + "occured during initialization.");
+            }
+        }
+    }
+
+    /**
+     * @return Returns the defaultDnSuffix.
+     */
+    public String getDefaultDnSuffix()
+    {
+        return defaultDnSuffix;
+    }
+
+    /**
+     * @param defaultDnSuffix The defaultDnSuffix to set.
+     */
+    public void setDefaultDnSuffix(String defaultDnSuffix)
+    {
+        this.defaultDnSuffix = defaultDnSuffix;
+    }
+
+    /**
+     * @return Returns the groupsOu.
+     */
+    public String getGroupsOu()
+    {
+        return groupsOu;
+    }
+
+    /**
+     * @param groupsOu The groupsOu to set.
+     */
+    public void setGroupsOu(String groupsOu)
+    {
+        this.groupsOu = groupsOu;
+    }
+
+    /**
+     * @return Returns the initialContextFactory.
+     */
+    public String getInitialContextFactory()
+    {
+        return initialContextFactory;
+    }
+
+    /**
+     * @param initialContextFactory The initialContextFactory to set.
+     */
+    public void setInitialContextFactory(String initialContextFactory)
+    {
+        this.initialContextFactory = initialContextFactory;
+    }
+
+    /**
+     * @return Returns the ldapServerName.
+     */
+    public String getLdapServerName()
+    {
+        return ldapServerName;
+    }
+
+    /**
+     * @param ldapServerName The ldapServerName to set.
+     */
+    public void setLdapServerName(String ldapServerName)
+    {
+        this.ldapServerName = ldapServerName;
+    }
+
+    /**
+     * @return Returns the ldapServerPort.
+     */
+    public String getLdapServerPort()
+    {
+        return ldapServerPort;
+    }
+
+    /**
+     * @param ldapServerPort The ldapServerPort to set.
+     */
+    public void setLdapServerPort(String ldapServerPort)
+    {
+        this.ldapServerPort = ldapServerPort;
+    }
+
+    /**
+     * @return Returns the rootContext.
+     */
+    public String getRootContext()
+    {
+        return rootContext;
+    }
+
+    /**
+     * @param rootContext The rootContext to set.
+     */
+    public void setRootContext(String rootContext)
+    {
+        this.rootContext = rootContext;
+    }
+
+    /**
+     * @return Returns the rootDn.
+     */
+    public String getRootDn()
+    {
+        return rootDn;
+    }
+
+    /**
+     * @param rootDn The rootDn to set.
+     */
+    public void setRootDn(String rootDn)
+    {
+        this.rootDn = rootDn;
+    }
+
+    /**
+     * @return Returns the rootPassword.
+     */
+    public String getRootPassword()
+    {
+        return rootPassword;
+    }
+
+    /**
+     * @param rootPassword The rootPassword to set.
+     */
+    public void setRootPassword(String rootPassword)
+    {
+        this.rootPassword = rootPassword;
+    }
+
+    /**
+     * @return Returns the usersOu.
+     */
+    public String getUsersOu()
+    {
+        return usersOu;
+    }
+
+    /**
+     * @param usersOu The usersOu to set.
+     */
+    public void setUsersOu(String usersOu)
+    {
+        this.usersOu = usersOu;
+    }
+}

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapGroupDaoImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapGroupDaoImpl.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapGroupDaoImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapGroupDaoImpl.java Sat Nov  5 19:40:32 2005
@@ -17,13 +17,11 @@
 
 import java.security.Principal;
 
-import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.security.SecurityException;
 import org.apache.jetspeed.security.impl.GroupPrincipalImpl;
 
@@ -32,32 +30,40 @@
  * DAO for handling group objects.
  * </p>
  * 
- * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>
+ * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>, <a
+ *         href="mailto:dlestrat@apache.org">David Le Strat</a>
  */
 public class LdapGroupDaoImpl extends LdapPrincipalDaoImpl
 {
-    /** The logger. */
-    private static final Log LOG = LogFactory.getLog(LdapGroupDaoImpl.class);
-
-    /** The group class name. */
-    private static final String GROUP_CLASSNAME = "com.jetspeed.dung.GroupClassImpl";
 
     /**
      * <p>
      * Default constructor.
      * </p>
      * 
-     * @throws NamingException A {@link NamingException}.
      * @throws SecurityException A {@link SecurityException}.
      */
-    public LdapGroupDaoImpl() throws SecurityException, NamingException
+    public LdapGroupDaoImpl() throws SecurityException
     {
+        super();
     }
 
     /**
      * <p>
-     * A template method for defining the attributes for a particular LDAP
-     * class.
+     * Initializes the dao.
+     * </p>
+     * 
+     * @param ldapConfig Holds the ldap binding configuration.
+     * @throws SecurityException A {@link SecurityException}.
+     */
+    public LdapGroupDaoImpl(LdapBindingConfig ldapConfig) throws SecurityException
+    {
+        super(ldapConfig);
+    }
+
+    /**
+     * <p>
+     * A template method for defining the attributes for a particular LDAP class.
      * </p>
      * 
      * @param principalUid The principal uid.
@@ -72,12 +78,29 @@
         classes.add("uidObject");
         classes.add("jetspeed-2-group");
         attrs.put(classes);
-        attrs.put("j2-classname", GROUP_CLASSNAME);
         attrs.put("uid", principalUid);
+        attrs.put("ou", getGroupsOu());
         return attrs;
     }
 
     /**
+     * @see org.apache.jetspeed.security.spi.impl.ldap.LdapPrincipalDaoImpl#getDnSuffix()
+     */
+    protected String getDnSuffix()
+    {
+        String suffix = "";
+        if (!StringUtils.isEmpty(getGroupsOu()))
+        {
+            suffix += ",ou=" + getGroupsOu();
+        }
+        if (!StringUtils.isEmpty(getDefaultDnSuffix()))
+        {
+            suffix += getDefaultDnSuffix();
+        }
+        return suffix;
+    }
+
+    /**
      * <p>
      * Creates a GroupPrincipal object.
      * </p>
@@ -87,7 +110,7 @@
      */
     protected Principal makePrincipal(String principalUid)
     {
-        return new GroupPrincipalImpl(convertUidFromLdapAcceptableName(principalUid));
+        return new GroupPrincipalImpl(principalUid);
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDao.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDao.java?rev=331065&r1=331064&r2=331065&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDao.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/spi/impl/ldap/LdapPrincipalDao.java Sat Nov  5 19:40:32 2005
@@ -23,7 +23,8 @@
  * Generic DAO interface for LDAP principals.
  * </p>
  * 
- * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>
+ * @author <a href="mailto:mike.long@dataline.com">Mike Long </a>, <a
+ *         href="mailto:dlestrat@apache.org">David Le Strat</a>
  */
 public interface LdapPrincipalDao extends LdapReadOnlyPrincipalDao
 {
@@ -35,7 +36,7 @@
      * @param principalUid The principal uid.
      * @throws SecurityException Throws a {@link SecurityException}.
      */
-    public abstract void create(final String principalUid) throws SecurityException;
+    abstract void create(final String principalUid) throws SecurityException;
 
     /**
      * <p>
@@ -45,15 +46,26 @@
      * @param principalUid The principal uid.
      * @throws SecurityException Throws a {@link SecurityException}.
      */
-    public abstract void delete(final String principalUid) throws SecurityException;
+    abstract void delete(final String principalUid) throws SecurityException;
 
     /**
      * <p>
      * Search the ldap directory for the principal.
      * </p>
      * 
-     * @param principalUid The uid value of the principal. If empty this method
+     * @param principalUid The uid value of the principal.
+     * @param principalType The type of principal.
      * @return All the objects of this LDAP class type.
      */
-    public Principal[] find(final String principalUid) throws SecurityException;
+    Principal[] find(final String principalUid, String principalType) throws SecurityException;
+
+    /**
+     * <p>
+     * Converts the uid to an ldap acceptable name.
+     * </p>
+     * 
+     * @param uid The uid.
+     * @return The converted name.
+     */
+    String convertUidToLdapAcceptableName(String uid);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message