feat(security): Ajoute l'authentification Keycloak SSO et migre les commandes

Supprime la commande AccountCommand, la migration et ajoute l'authentification
Keycloak SSO. Crée les vues de base pour le tableau de bord.
```
This commit is contained in:
Serreau Jovann
2026-01-15 18:04:01 +01:00
parent 662bb0bcc6
commit 3b0ce1314f
38 changed files with 1485 additions and 604 deletions

View File

@@ -8,6 +8,7 @@ use App\Form\RequestPasswordConfirmType;
use App\Form\RequestPasswordRequestType;
use App\Service\ResetPassword\Event\ResetPasswordConfirmEvent;
use App\Service\ResetPassword\Event\ResetPasswordEvent;
use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -21,9 +22,27 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
class HomeController extends AbstractController
{
#[Route(path: '/', name: 'app_home', options: ['sitemap' => false], methods: ['GET'])]
#[Route('/connect/keycloak', name: 'connect_keycloak_start')]
public function connect(ClientRegistry $clientRegistry)
{
// Redirects to Keycloak
return $clientRegistry
->getClient('keycloak')
->redirect(['email', 'profile','openid'], []);
}
#[Route('/oauth/sso', name: 'connect_keycloak_check')]
public function connectCheck(Request $request)
{
// This method stays empty; the authenticator will intercept it!
}
#[Route(path: '/', name: 'app_home', options: ['sitemap' => false], methods: ['GET','POST'])]
public function index(AuthenticationUtils $authenticationUtils): Response
{
if($this->getUser()){
return $this->redirectToRoute('app_crm');
}
return $this->render('home.twig',[
'last_username' => $authenticationUtils->getLastUsername(),
'error' => $authenticationUtils->getLastAuthenticationError(),