@@ -290,14 +290,19 @@ filter
290290
291291This key lets you configure which LDAP query will be used. The ``{uid_key} ``
292292string 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} ``.
295300
296301For example, with a ``uid_key `` of ``uid ``, and if you are trying to
297302load the user ``fabpot ``, the final string will be: ``(uid=fabpot) ``.
298303
299304If you pass ``null `` as the value of this option, the default filter is used
300- ``({uid_key}={username }) ``.
305+ ``({uid_key}={user_identifier }) ``.
301306
302307To prevent `LDAP injection `_, the username will be escaped.
303308
@@ -324,15 +329,15 @@ number or contain white spaces.
324329dn_string
325330.........
326331
327- **type **: ``string `` **default **: ``{username } ``
332+ **type **: ``string `` **default **: ``{user_identifier } ``
328333
329334This 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
331336replaced by the actual username of the person trying to authenticate.
332337
333338For example, if your users have DN strings in the form
334339``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 ``.
336341
337342query_string
338343............
@@ -342,8 +347,8 @@ query_string
342347This (optional) key makes the user provider search for a user and then use the
343348found DN for the bind process. This is useful when using multiple LDAP user
344349providers 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 .
347352
348353When this option is used, ``query_string `` will search in the DN specified by
349354``dn_string `` and the DN resulted of the ``query_string `` will be used to
@@ -376,7 +381,7 @@ Configuration example for form login
376381 form_login_ldap :
377382 # ...
378383 service : Symfony\Component\Ldap\Ldap
379- dn_string : ' uid={username },dc=example,dc=com'
384+ dn_string : ' uid={user_identifier },dc=example,dc=com'
380385
381386 .. code-block :: xml
382387
@@ -393,7 +398,7 @@ Configuration example for form login
393398 <config >
394399 <firewall name =" main" >
395400 <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" />
397402 </firewall >
398403 </config >
399404 </srv : container >
@@ -408,7 +413,7 @@ Configuration example for form login
408413 $security->firewall('main')
409414 ->formLoginLdap()
410415 ->service(Ldap::class)
411- ->dnString('uid={username },dc=example,dc=com')
416+ ->dnString('uid={user_identifier },dc=example,dc=com')
412417 ;
413418 };
414419
@@ -428,7 +433,7 @@ Configuration example for HTTP Basic
428433 stateless : true
429434 http_basic_ldap :
430435 service : Symfony\Component\Ldap\Ldap
431- dn_string : ' uid={username },dc=example,dc=com'
436+ dn_string : ' uid={user_identifier },dc=example,dc=com'
432437
433438 .. code-block :: xml
434439
@@ -447,7 +452,7 @@ Configuration example for HTTP Basic
447452
448453 <firewall name =" main" stateless =" true" >
449454 <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" />
451456 </firewall >
452457 </config >
453458 </srv : container >
@@ -463,7 +468,7 @@ Configuration example for HTTP Basic
463468 ->stateless(true)
464469 ->formLoginLdap()
465470 ->service(Ldap::class)
466- ->dnString('uid={username },dc=example,dc=com')
471+ ->dnString('uid={user_identifier },dc=example,dc=com')
467472 ;
468473 };
469474
@@ -484,7 +489,7 @@ Configuration example for form login and query_string
484489 form_login_ldap :
485490 service : Symfony\Component\Ldap\Ldap
486491 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))'
488493 search_dn : ' ...'
489494 search_password : ' the-raw-password'
490495
@@ -505,7 +510,7 @@ Configuration example for form login and query_string
505510 <!-- ... -->
506511 <form-login-ldap service =" Symfony\Component\Ldap\Ldap"
507512 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))"
509514 search-dn =" ..."
510515 search-password =" the-raw-password" />
511516 </firewall >
@@ -524,7 +529,7 @@ Configuration example for form login and query_string
524529 ->formLoginLdap()
525530 ->service(Ldap::class)
526531 ->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))')
528533 ->searchDn('...')
529534 ->searchPassword('the-raw-password')
530535 ;
0 commit comments