* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; /** * Controller used to manage the application security. * See http://symfony.com/doc/current/cookbook/security/form_login_setup.html. */ class SecurityController extends AbstractController { /** * @Route("/login", name="security_login") */ public function login(AuthenticationUtils $helper): Response { return $this->render('security/login.html.twig', [ 'last_username' => $helper->getLastUsername(), 'error' => $helper->getLastAuthenticationError(), ]); } /** * This is the route the user can use to logout. * * But, this will never be executed. Symfony will intercept this first * and handle the logout automatically. See logout in config/packages/security.yaml * * @Route("/logout", name="security_logout") */ public function logout(): void { throw new \Exception('This should never be reached!'); } }