Skip to content

Commit 833a9e0

Browse files
committed
bug symfony#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 symfony#39663 | License | MIT | Doc PR | n/a The 4.4 part of symfony#39859 Commits ------- ab2ca71 [Security] Replace message data in JSON security error response
2 parents 8076c2f + ab2ca71 commit 833a9e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ private function onFailure(Request $request, AuthenticationException $failed): R
191191
}
192192

193193
if (!$this->failureHandler) {
194-
return new JsonResponse(['error' => $failed->getMessageKey()], 401);
194+
$errorMessage = strtr($failed->getMessageKey(), $failed->getMessageData());
195+
196+
return new JsonResponse(['error' => $errorMessage], 401);
195197
}
196198

197199
$response = $this->failureHandler->onAuthenticationFailure($request, $failed);

0 commit comments

Comments
 (0)