@@ -290,14 +290,19 @@ filter
290
290
291
291
This key lets you configure which LDAP query will be used. The ``{uid_key} ``
292
292
string will be replaced by the value of the ``uid_key `` configuration value
293
- (by default, ``sAMAccountName ``), and the ``{username} `` string will be
294
- replaced by the username you are trying to load.
293
+ (by default, ``sAMAccountName ``), and the ``{user_identifier} `` string will be
294
+ replaced by the user identified you are trying to load.
295
+
296
+ .. deprecated :: 6.2
297
+
298
+ Starting from Symfony 6.2, the ``{username} `` string was deprecated in favor
299
+ of ``{user_identifier} ``.
295
300
296
301
For example, with a ``uid_key `` of ``uid ``, and if you are trying to
297
302
load the user ``fabpot ``, the final string will be: ``(uid=fabpot) ``.
298
303
299
304
If you pass ``null `` as the value of this option, the default filter is used
300
- ``({uid_key}={username }) ``.
305
+ ``({uid_key}={user_identifier }) ``.
301
306
302
307
To prevent `LDAP injection `_, the username will be escaped.
303
308
@@ -324,15 +329,15 @@ number or contain white spaces.
324
329
dn_string
325
330
.........
326
331
327
- **type **: ``string `` **default **: ``{username } ``
332
+ **type **: ``string `` **default **: ``{user_identifier } ``
328
333
329
334
This key defines the form of the string used to compose the
330
- DN of the user, from the username. The ``{username } `` string is
335
+ DN of the user, from the username. The ``{user_identifier } `` string is
331
336
replaced by the actual username of the person trying to authenticate.
332
337
333
338
For example, if your users have DN strings in the form
334
339
``uid=einstein,dc=example,dc=com ``, then the ``dn_string `` will be
335
- ``uid={username },dc=example,dc=com ``.
340
+ ``uid={user_identifier },dc=example,dc=com ``.
336
341
337
342
query_string
338
343
............
@@ -342,8 +347,8 @@ query_string
342
347
This (optional) key makes the user provider search for a user and then use the
343
348
found DN for the bind process. This is useful when using multiple LDAP user
344
349
providers with different ``base_dn ``. The value of this option must be a valid
345
- search string (e.g. ``uid="{username }" ``). The placeholder value will be
346
- replaced by the actual username .
350
+ search string (e.g. ``uid="{user_identifier }" ``). The placeholder value will be
351
+ replaced by the actual user identifier .
347
352
348
353
When this option is used, ``query_string `` will search in the DN specified by
349
354
``dn_string `` and the DN resulted of the ``query_string `` will be used to
@@ -376,7 +381,7 @@ Configuration example for form login
376
381
form_login_ldap :
377
382
# ...
378
383
service : Symfony\Component\Ldap\Ldap
379
- dn_string : ' uid={username },dc=example,dc=com'
384
+ dn_string : ' uid={user_identifier },dc=example,dc=com'
380
385
381
386
.. code-block :: xml
382
387
@@ -393,7 +398,7 @@ Configuration example for form login
393
398
<config >
394
399
<firewall name =" main" >
395
400
<form-login-ldap service =" Symfony\Component\Ldap\Ldap"
396
- dn-string =" uid={username },dc=example,dc=com" />
401
+ dn-string =" uid={user_identifier },dc=example,dc=com" />
397
402
</firewall >
398
403
</config >
399
404
</srv : container >
@@ -408,7 +413,7 @@ Configuration example for form login
408
413
$security->firewall('main')
409
414
->formLoginLdap()
410
415
->service(Ldap::class)
411
- ->dnString('uid={username },dc=example,dc=com')
416
+ ->dnString('uid={user_identifier },dc=example,dc=com')
412
417
;
413
418
};
414
419
@@ -428,7 +433,7 @@ Configuration example for HTTP Basic
428
433
stateless : true
429
434
http_basic_ldap :
430
435
service : Symfony\Component\Ldap\Ldap
431
- dn_string : ' uid={username },dc=example,dc=com'
436
+ dn_string : ' uid={user_identifier },dc=example,dc=com'
432
437
433
438
.. code-block :: xml
434
439
@@ -447,7 +452,7 @@ Configuration example for HTTP Basic
447
452
448
453
<firewall name =" main" stateless =" true" >
449
454
<http-basic-ldap service =" Symfony\Component\Ldap\Ldap"
450
- dn-string =" uid={username },dc=example,dc=com" />
455
+ dn-string =" uid={user_identifier },dc=example,dc=com" />
451
456
</firewall >
452
457
</config >
453
458
</srv : container >
@@ -463,7 +468,7 @@ Configuration example for HTTP Basic
463
468
->stateless(true)
464
469
->formLoginLdap()
465
470
->service(Ldap::class)
466
- ->dnString('uid={username },dc=example,dc=com')
471
+ ->dnString('uid={user_identifier },dc=example,dc=com')
467
472
;
468
473
};
469
474
@@ -484,7 +489,7 @@ Configuration example for form login and query_string
484
489
form_login_ldap :
485
490
service : Symfony\Component\Ldap\Ldap
486
491
dn_string : ' dc=example,dc=com'
487
- query_string : ' (&(uid={username })(memberOf=cn=users,ou=Services,dc=example,dc=com))'
492
+ query_string : ' (&(uid={user_identifier })(memberOf=cn=users,ou=Services,dc=example,dc=com))'
488
493
search_dn : ' ...'
489
494
search_password : ' the-raw-password'
490
495
@@ -505,7 +510,7 @@ Configuration example for form login and query_string
505
510
<!-- ... -->
506
511
<form-login-ldap service =" Symfony\Component\Ldap\Ldap"
507
512
dn-string =" dc=example,dc=com"
508
- query-string =" (& (uid={username })(memberOf=cn=users,ou=Services,dc=example,dc=com))"
513
+ query-string =" (& (uid={user_identifier })(memberOf=cn=users,ou=Services,dc=example,dc=com))"
509
514
search-dn =" ..."
510
515
search-password =" the-raw-password" />
511
516
</firewall >
@@ -524,7 +529,7 @@ Configuration example for form login and query_string
524
529
->formLoginLdap()
525
530
->service(Ldap::class)
526
531
->dnString('dc=example,dc=com')
527
- ->queryString('(& (uid={username })(memberOf=cn=users,ou=Services,dc=example,dc=com))')
532
+ ->queryString('(& (uid={user_identifier })(memberOf=cn=users,ou=Services,dc=example,dc=com))')
528
533
->searchDn('...')
529
534
->searchPassword('the-raw-password')
530
535
;
0 commit comments