✨ feat(security): Remplace entry_point par authenticators dans security.yaml
🐛 fix(security/LoginFormAuthenticator): Corrige la logique de supports() pour authentification.
This commit is contained in:
@@ -24,7 +24,8 @@ security:
|
||||
check_path: app_login # L'URL où le formulaire POST sera soumis
|
||||
enable_csrf: true # Active la protection CSRF
|
||||
csrf_token_id: authenticate # ID du jeton CSRF (doit correspondre à celui dans votre Twig)
|
||||
entry_point: App\Security\LoginFormAuthenticator
|
||||
authenticators:
|
||||
- App\Security\LoginFormAuthenticator
|
||||
logout:
|
||||
path: app_logout # La route pour la déconnexion
|
||||
target: app_login # Redirection après déconnexion réussie
|
||||
|
||||
@@ -37,6 +37,14 @@ class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function supports(Request $request): bool
|
||||
{
|
||||
echo $request->attributes->get('_route');
|
||||
die();
|
||||
return $request->attributes->get('_route') === self::LOGIN_ROUTE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request La requête HTTP entrante
|
||||
* @return Passport Le passeport contenant l'utilisateur et les informations d'authentification
|
||||
|
||||
Reference in New Issue
Block a user