Skip to content

Commit f0c28c7

Browse files
committed
[Security] Replace message data in JSON security error response
1 parent 4a63853 commit f0c28c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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)