@@ -51,6 +51,7 @@ public function getAdapter() {
51
51
$ conf ->getProperty (self ::KEY_REFERRALS ))
52
52
->setLDAPStartTLS (
53
53
$ conf ->getProperty (self ::KEY_START_TLS ))
54
+ ->setAlwaysSearch ($ conf ->getProperty (self ::KEY_ALWAYS_SEARCH ))
54
55
->setAnonymousUsername (
55
56
$ conf ->getProperty (self ::KEY_ANONYMOUS_USERNAME ))
56
57
->setAnonymousPassword (
@@ -194,6 +195,7 @@ public function processLoginRequest(
194
195
const KEY_START_TLS = 'ldap:start-tls ' ;
195
196
const KEY_ANONYMOUS_USERNAME = 'ldap:anoynmous-username ' ;
196
197
const KEY_ANONYMOUS_PASSWORD = 'ldap:anonymous-password ' ;
198
+ const KEY_ALWAYS_SEARCH = 'ldap:always-search ' ;
197
199
const KEY_ACTIVEDIRECTORY_DOMAIN = 'ldap:activedirectory-domain ' ;
198
200
199
201
private function getPropertyKeys () {
@@ -206,6 +208,7 @@ private function getPropertyLabels() {
206
208
self ::KEY_PORT => pht ('LDAP Port ' ),
207
209
self ::KEY_DISTINGUISHED_NAME => pht ('Base Distinguished Name ' ),
208
210
self ::KEY_SEARCH_ATTRIBUTES => pht ('Search Attributes ' ),
211
+ self ::KEY_ALWAYS_SEARCH => pht ('Always Search ' ),
209
212
self ::KEY_ANONYMOUS_USERNAME => pht ('Anonymous Username ' ),
210
213
self ::KEY_ANONYMOUS_PASSWORD => pht ('Anonymous Password ' ),
211
214
self ::KEY_USERNAME_ATTRIBUTE => pht ('Username Attribute ' ),
@@ -276,10 +279,8 @@ public function extendEditForm(
276
279
pht ('Follow referrals. Disable this for Windows AD 2003. ' ),
277
280
self ::KEY_START_TLS =>
278
281
pht ('Start TLS after binding to the LDAP server. ' ),
279
- self ::KEY_ANONYMOUS_USERNAME =>
280
- pht ('Username to bind with before searching. ' ),
281
- self ::KEY_ANONYMOUS_PASSWORD =>
282
- pht ('Password to bind with before searching. ' ),
282
+ self ::KEY_ALWAYS_SEARCH =>
283
+ pht ('Always bind and search, even without a username and password. ' ),
283
284
);
284
285
285
286
$ types = array (
@@ -288,6 +289,7 @@ public function extendEditForm(
288
289
self ::KEY_SEARCH_ATTRIBUTES => 'textarea ' ,
289
290
self ::KEY_REALNAME_ATTRIBUTES => 'list ' ,
290
291
self ::KEY_ANONYMOUS_PASSWORD => 'password ' ,
292
+ self ::KEY_ALWAYS_SEARCH => 'checkbox ' ,
291
293
);
292
294
293
295
$ instructions = array (
@@ -308,15 +310,16 @@ public function extendEditForm(
308
310
" - Your LDAP server is configured in some other way that prevents " .
309
311
" direct binding from working correctly. \n\n" .
310
312
"**To bind directly**, enter the LDAP attribute corresponding to the " .
311
- "login name into this box. Often, this is something like `sn` or " .
312
- "` uid`. This is the simplest configuration, but will only work if the " .
313
- "username is part of the distinguished name, and won't let you apply " .
314
- "complex restrictions to logins. \n\n" .
313
+ "login name into the **Search Attributes** box below . Often, this is " .
314
+ "something like `sn` or ` uid`. This is the simplest configuration, " .
315
+ "but will only work if the username is part of the distinguished " .
316
+ "name, and won't let you apply complex restrictions to logins. \n\n" .
315
317
" lang=text,name=Simple Direct Binding \n" .
316
318
" sn \n\n" .
317
319
"**To search first**, provide an anonymous username and password " .
318
- "below, then enter one or more search queries into this field, one " .
319
- "per line. After binding, these queries will be used to identify the " .
320
+ "below (or check the **Always Search** checkbox), then enter one " .
321
+ "or more search queries into this field, one per line. " .
322
+ "After binding, these queries will be used to identify the " .
320
323
"record associated with the login name the user typed. \n\n" .
321
324
"Searches will be tried in order until a matching record is found. " .
322
325
"Each query can be a simple attribute name (like `sn` or `mail`), " .
@@ -333,7 +336,7 @@ public function extendEditForm(
333
336
" mail \n" .
334
337
" sn \n\n" .
335
338
"If your LDAP directory is more complex, or you want to perform " .
336
- "sophisticated filtering, you can use one or more queries. Depending " .
339
+ "sophisticated filtering, you can use more complex queries. Depending " .
337
340
"on your directory structure, this example might allow users to login " .
338
341
"with either their email address or username, but only if they're in " .
339
342
"specific departments: \n\n" .
@@ -342,6 +345,10 @@ public function extendEditForm(
342
345
" (&(sn= \${login})(|(departmentNumber=1)(departmentNumber=2))) \n\n" .
343
346
"All of the attribute names used here are just examples: your LDAP " .
344
347
"server may use different attribute names. " ),
348
+ self ::KEY_ALWAYS_SEARCH => pht (
349
+ "To search for an LDAP record before authenticating, either check " .
350
+ "the **Always Search** checkbox or enter an anonymous " .
351
+ "username and password to use to perform the search. " ),
345
352
self ::KEY_USERNAME_ATTRIBUTE => pht (
346
353
"Optionally, specify a username attribute to use to prefill usernames " .
347
354
"when registering a new account. This is purely cosmetic and does not " .
0 commit comments