<?php
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;
use Symfony\Component\HttpFoundation\Session\Session;
class SecurityController extends AbstractController
{
/**
* @Route("/", name="login")
*/
public function login(AuthenticationUtils $authenticationUtils): Response
{
$state = bin2hex(random_bytes(16));
$baseUrl = 'http://account.dev.netways.fr/authorize?response_type=code&client_id='.$_ENV["CLIENT_ID"].'&redirect_uri=https://client.netways.link/user&state='.$state;
return $this->render('security/login.html.twig', [
'client_id' => $_ENV["CLIENT_ID"],
'baseUrl' => $baseUrl,
]);
}
/**
* @Route("/logout", name="logout")
*/
public function logout()
{
$session = new Session();
$session->clear();
throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
}
}