src/Controller/LoginController.php line 45
<?phpnamespace App\Controller;use Exception;use KnpU\OAuth2ClientBundle\Client\ClientRegistry;use Symfony\Bridge\Twig\Attribute\Template;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;class LoginController extends AbstractController{#[Route('/login', name: 'app_login')]#[Template('login/login.html.twig')]public function index(AuthenticationUtils $authenticationUtils): array{// get the login error if there is one$error = $authenticationUtils->getLastAuthenticationError();// last username entered by the user$lastUsername = $authenticationUtils->getLastUsername();return ['last_username' => $lastUsername,'error' => $error,];}/*** @throws Exception*/#[Route('/logout', name: 'app_logout', methods: [Request::METHOD_GET])]public function logout(){}/*** Link to this controller to start the "connect" process*/#[Route('/connect/google', name: 'connect_google')]public function connectAction(ClientRegistry $clientRegistry): RedirectResponse{return $clientRegistry->getClient('google') // key used in config/packages/knpu_oauth2_client.yaml->redirect(['profile', 'email']);}/*** This should remain blank because we have a guard authenticator*/#[Route('/connect/google/check', name: 'connect_google_check')]public function connectCheckAction(){}}