Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50541
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Jan 2011 17:35:06 +0000 (17:35 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 4 Jan 2011 17:35:06 +0000 (17:35 +0000)
Add support for sizeLimit and timeLimit on the JNDIRealm

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1055115 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/realm/JNDIRealm.java
webapps/docs/changelog.xml
webapps/docs/config/realm.xml

index 0e9b45f..a4914e8 100644 (file)
@@ -389,6 +389,18 @@ public class JNDIRealm extends RealmBase {
      */
     protected String connectionTimeout = "5000";
     
+    /**
+     * The sizeLimit (also known as the countLimit) to use when the realm is
+     * configured with {@link #userSearch}. Zero for no limit.
+     */
+    protected long sizeLimit = 0;
+
+    /**
+     * The timeLimit (in milliseconds) to use when the realm is configured with
+     * {@link #userSearch}. Zero for no limit.
+     */
+    protected int timeLimit = 0;
+
     // ------------------------------------------------------------- Properties
 
     /**
@@ -900,6 +912,26 @@ public class JNDIRealm extends RealmBase {
     }
 
 
+    public long getSizeLimit() {
+        return sizeLimit;
+    }
+
+
+    public void setSizeLimit(long sizeLimit) {
+        this.sizeLimit = sizeLimit;
+    }
+
+
+    public int getTimeLimit() {
+        return timeLimit;
+    }
+
+
+    public void setTimeLimit(int timeLimit) {
+        this.timeLimit = timeLimit;
+    }
+
+
     /**
      * Return descriptive information about this Realm implementation and
      * the corresponding version number, in the format
@@ -1334,6 +1366,9 @@ public class JNDIRealm extends RealmBase {
             constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
         }
 
+        constraints.setCountLimit(sizeLimit);
+        constraints.setTimeLimit(timeLimit);
+
         // Specify the attributes to be retrieved
         if (attrIds == null)
             attrIds = new String[0];
index 32028d3..a3a04ac 100644 (file)
         Log a warning if context.xml files define values for properties  that do
         not exist (e.g. if there is a typo in a property name). (markt)
       </fix>
+      <add>
+        <bug>50541</bug>: Add support for setting the size limit and time limit
+        for LDAP seaches when using the JNDI Realm with <code>userSearch</code>.
+        (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">
index 1204be4..0aa1c03 100644 (file)
         to be searched.</p>
       </attribute>
 
+      <attribute name="sizeLimit" required="false">
+        <p>Specifies the maximum number of records to return when using the
+        <code>userSearch</code> attribute. If not specified, the default of
+        <code>0</code> is used which indicates no limit.</p>
+      </attribute>
+
+      <attribute name="timeLimit" required="false">
+        <p>Specifies the time (in milliseconds) to wait for records to be
+        returned when using the <code>userSearch</code> attribute. If not
+        specified, the default of <code>0</code> is used which indicates no
+        limit.</p>
+      </attribute>
+
       <attribute name="userBase" required="false">
         <p>The base element for user searches performed using the
         <code>userSearch</code> expression.  Not used if you are using