You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: security/form_login_setup.rst
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -174,7 +174,7 @@ a traditional HTML form that submits to ``/login``:
174
174
175
175
use Symfony\Component\HttpFoundation\RedirectResponse;
176
176
use Symfony\Component\HttpFoundation\Request;
177
-
use Symfony\Component\Routing\RouterInterface;
177
+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
178
178
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
179
179
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
180
180
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
@@ -185,21 +185,22 @@ a traditional HTML form that submits to ``/login``:
185
185
use Symfony\Component\Security\Csrf\CsrfToken;
186
186
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
187
187
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
188
+
use Symfony\Component\Security\Guard\PasswordAuthenticatedInterface;
188
189
use Symfony\Component\Security\Http\Util\TargetPathTrait;
189
190
190
-
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator
191
+
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements PasswordAuthenticatedInterface
191
192
{
192
193
use TargetPathTrait;
193
194
194
195
private $entityManager;
195
-
private $router;
196
+
private $urlGenerator;
196
197
private $csrfTokenManager;
197
198
private $passwordEncoder;
198
199
199
-
public function __construct(EntityManagerInterface $entityManager, RouterInterface $router, CsrfTokenManagerInterface $csrfTokenManager, UserPasswordEncoderInterface $passwordEncoder)
200
+
public function __construct(EntityManagerInterface $entityManager, UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $csrfTokenManager, UserPasswordEncoderInterface $passwordEncoder)
200
201
{
201
202
$this->entityManager = $entityManager;
202
-
$this->router = $router;
203
+
$this->urlGenerator = $urlGenerator;
203
204
$this->csrfTokenManager = $csrfTokenManager;
204
205
$this->passwordEncoder = $passwordEncoder;
205
206
}
@@ -253,13 +254,13 @@ a traditional HTML form that submits to ``/login``:
253
254
return new RedirectResponse($targetPath);
254
255
}
255
256
256
-
// For example : return new RedirectResponse($this->router->generate('some_route'));
257
+
// For example : return new RedirectResponse($this->urlGenerator->generate('some_route'));
257
258
throw new \Exception('TODO: provide a valid redirect inside '.__FILE__);
0 commit comments