This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Security] Rename UserInterface::getUsername() to getUserIdentifier()
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | Fix part of #39308
| License | MIT
| Doc PR | tbd
This continues the great work by @chalasr in #40267 and rounds up the `UserInterface` cleanup.
The `getUsername()` has been a point of confusion for many years. In today's applications, many domains no longer have a username, but instead rely on a user's email address or the like. Even more, this username has to be unique for all Security functionality to work correctly - so it's more confusing in complex applications relying on e.g. "username+company" to be unique.
**This PR proposes to rename the method to `getUserIdentifier()`**, to more clearly indicate the goal of the method (note: I'm open for any other suggestion).
For BC, the `getUsername()` method is deprecated in 5.3 and `getUserIdentifier()` will be added to the `UserInterface` in 6.0. PHPdocs are used to improve type-hinting for 5.3 & 5.4. Both authentication managers (the legacy and experimental one) check the authenticated user object and trigger a deprecation if `getUserIdentifier()` is not implemented.
* [x] **judge whether we need to have better deprecations for calling `getUsername()` in the application code.**
Consistent with these changes, I've also done the same BC change for `TokenInterface::getUsername()`.
* [x] **do the same for remember me's `PersistentTokenInterface::getUsername()`**
* [x] **also rename `UserProviderInterface::loadUserByUsername()` & `UsernameNotFoundException`**
* [x] **also rename `UserLoaderInterface::loadUserByUsername()`**
I'm very much looking forward for feedback and help for this important, but BC-heavy, rename. 😃
Commits
-------
8afd7a3765 [Security] Rename UserInterface::getUsername() to getUserIdentifier()
This PR was merged into the 5.2 branch.
Discussion
----------
[Security] Use more concrete user classes in tests
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Similar to #40609.
https://github.com/symfony/symfony/pull/40145 keeps resisting... this should be the last mocked user & user provider in the 5.2 tests, looking at the failing deps=high build.
Commits
-------
631408b757 [Security] Use more concrete user classes in tests
This PR was merged into the 5.2 branch.
Discussion
----------
[Security] Use concrete UserInterface and UserProviderInterface classes in the tests
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | n/a
Fixes failing deps=high builds in #40403
Commits
-------
89d9de2077 Use concrete user related classes in the tests