Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The firewall ID must be passed to the UsernamePasswordToken to ensure that authentication is done correctly if there are multiple firewalls.
Having a hard-coded value prevents the AuthProvider to be used for more than one firewall.
In addition, a provider key which does not match the actual firewall ID prevents the Twig functions logout_path() and logout_url() to work correctly ("No LogoutListener found for firewall key").
Adding the firewall ID to the auth provider configuration, as it is not there by default, seemed the easiest option for now. Another way would be to pass the providerKey as an additional constructor argument of the AuthenticationProvider. However, this would change the method signature and require adaptations of the service definitions.
See
Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider
for the implementation in the Symfony default authentication provider base class. The actual creation of the provider happens here (in the case of the DAO authentication provider).