public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
    {
        if (null === $this->logger) {
            return parent::onAuthenticationFailure($request, $exception);
        }

        if ($exception instanceof AccountStatusException && ($user = $exception->getUser()) instanceof UserInterface) {
            $username = $user->getUsername();
        } else {
            $username = $request->request->get('username');
        }

        $this->logger->info(
            $exception->getMessage(),
            ['contao' => new ContaoContext(__METHOD__, ContaoContext::ACCESS, $username)]
        );

        return parent::onAuthenticationFailure($request, $exception);
    }