```
✨ 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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user