From 45aeb9d099beebc09bd9b99b67caec17429e4e33 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 4 Jan 2011 17:35:06 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50541 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 | 35 +++++++++++++++++++++++++++ webapps/docs/changelog.xml | 5 ++++ webapps/docs/config/realm.xml | 13 ++++++++++ 3 files changed, 53 insertions(+) diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index 0e9b45f2e..a4914e838 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -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]; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 32028d310..a3a04acf4 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -157,6 +157,11 @@ 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) + + 50541: Add support for setting the size limit and time limit + for LDAP seaches when using the JNDI Realm with userSearch. + (markt) + diff --git a/webapps/docs/config/realm.xml b/webapps/docs/config/realm.xml index 1204be4b1..0aa1c034a 100644 --- a/webapps/docs/config/realm.xml +++ b/webapps/docs/config/realm.xml @@ -420,6 +420,19 @@ to be searched.

+ +

Specifies the maximum number of records to return when using the + userSearch attribute. If not specified, the default of + 0 is used which indicates no limit.

+
+ + +

Specifies the time (in milliseconds) to wait for records to be + returned when using the userSearch attribute. If not + specified, the default of 0 is used which indicates no + limit.

+
+

The base element for user searches performed using the userSearch expression. Not used if you are using -- 2.11.0