bug #39862 [Security] Replace message data in JSON security error response (wouterj)

This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Replace message data in JSON security error response

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix part of #39663
| License       | MIT
| Doc PR        | n/a

The 4.4 part of #39859

Commits
-------

ab2ca7145f [Security] Replace message data in JSON security error response
This commit is contained in:
Robin Chalas 2021-01-17 00:09:57 +01:00
commit 833a9e0a47

View File

@ -191,7 +191,9 @@ class UsernamePasswordJsonAuthenticationListener extends AbstractListener implem
}
if (!$this->failureHandler) {
return new JsonResponse(['error' => $failed->getMessageKey()], 401);
$errorMessage = strtr($failed->getMessageKey(), $failed->getMessageData());
return new JsonResponse(['error' => $errorMessage], 401);
}
$response = $this->failureHandler->onAuthenticationFailure($request, $failed);