@@ -282,39 +282,19 @@ associated with the user. It allows loading the user through the configured
|
282 | 282 | }
|
283 | 283 | }
|
284 | 284 |
|
285 |
| -It's a good practice to normalize the user identifier before using it. This |
286 |
| -ensures that variations like "john.doe", "John.Doe", or "JOHN.DOE" are treated |
287 |
| -as the same user. |
| 285 | +Some applications normalize user identifiers before processing them. For example, |
| 286 | +lowercasing identifiers helps treat values like "john.doe", "John.Doe", or |
| 287 | +"JOHN.DOE" as equivalent in systems where identifiers are case-insensitive. |
288 | 288 |
|
289 |
| -Normalization typically involves converting the identifier to lowercase and |
290 |
| -trimming extra spaces. For example, Google considers the following email |
291 |
| -addresses equivalent: `` [email protected]``, `` [email protected]``, and |
292 |
| -`` [email protected]``. This is due to normalization rules that remove dots and |
293 |
| -lowercase the address. |
294 |
| - |
295 |
| -In enterprise environments, users might authenticate using different identifier |
296 |
| -formats, such as: |
297 |
| - |
298 |
| - |
299 |
| -* ``acme.com\jdoe`` |
300 |
| -* ``https://acme.com/+jdoe`` |
301 |
| - |
302 |
| - |
303 |
| -Applying normalization (e.g. lowercasing, trimming, or unifying formats) helps |
304 |
| -ensure consistent identity resolution and prevents duplication caused by |
305 |
| -format differences. |
306 |
| - |
307 |
| -In Symfony applications, you can optionally pass a user identifier normalizer as |
308 |
| -the third argument to the ``UserBadge``. This callable receives the ``$userIdentifier`` |
309 |
| -and must return a normalized string. |
| 289 | +If needed, you can pass a normalizer as the third argument to ``UserBadge``. |
| 290 | +This callable receives the ``$userIdentifier`` and must return a string. |
310 | 291 |
|
311 | 292 | .. versionadded:: 7.3
|
312 | 293 |
|
313 | 294 | Support for user identifier normalizers was introduced in Symfony 7.3.
|
314 | 295 |
|
315 |
| -For instance, the example below uses a normalizer that converts usernames to |
316 |
| -a normalized, ASCII-only, lowercase format suitable for consistent comparison |
317 |
| -and storage:: |
| 296 | +The example below uses a normalizer that converts usernames to a normalized, |
| 297 | +ASCII-only, lowercase format:: |
318 | 298 |
|
319 | 299 | // src/Security/NormalizedUserBadge.php
|
320 | 300 | namespace App\Security;
|
|
0 commit comments