* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Guard\Authenticator; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Guard\AbstractGuardAuthenticator; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Http\Util\TargetPathTrait; /** * A base class to make form login authentication easier! * * @author Ryan Weaver */ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator { use TargetPathTrait; /** * Return the URL to the login page. * * @return string */ abstract protected function getLoginUrl(); /** * Override to change what happens after a bad username/password is submitted. * * @return RedirectResponse */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { if ($request->getSession() instanceof SessionInterface) { $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); } $url = $this->getLoginUrl(); return new RedirectResponse($url); } /** * Override to change what happens after successful authentication. * * @param Request $request * @param TokenInterface $token * @param string $providerKey * * @return RedirectResponse */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { @trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', get_class($this)), E_USER_DEPRECATED); if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) { throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', get_class($this))); } $targetPath = null; // if the user hit a secure page and start() was called, this was // the URL they were on, and probably where you want to redirect to if ($request->getSession() instanceof SessionInterface) { $targetPath = $this->getTargetPath($request->getSession(), $providerKey); } if (!$targetPath) { $targetPath = $this->getDefaultSuccessRedirectUrl(); } return new RedirectResponse($targetPath); } public function supportsRememberMe() { return true; } /** * Override to control what happens when the user hits a secure page * but isn't logged in yet. * * @return RedirectResponse */ public function start(Request $request, AuthenticationException $authException = null) { $url = $this->getLoginUrl(); return new RedirectResponse($url); } } __halt_compiler();----SIGNATURE:----gy1J5fVgt5X1gXQu3ELsHCMWnvy2XkL4xDNnDt68SuQB9yF/ycouuXXm3voIoEgioJxkz+kXh2fQzN+5u5YvJcm3i+Zx7/BxvfrAPKpJQN37WGPpae7XSa39VBpLGyTE8/zOIbeNVqELjHtzj10OdxzU0GsKjZwdQVwOgoviZNODrofg+rdJgybdI20LgKOh2kK855Fg2DQeEKKlXuNcjcS6pt96Ahh6/Frf4QW726IIgTgqzyURrH9YY2n7nFwTpV3fgYRyssnYkch6M3WLrAs+jGpvNn9o65S7fi7meDOEJQlMGBT43IcmEqDLi44W4cOB7EFD/dHx4DRfzGtuynMYcSp82cTM7bHHnE6XJ2epPpQJLX2A7S9CWQ9EY4EVigzShYW7uMyPfaySjF5WwqXSxox0IThl+3nKJ2a4NfCawM7dKet35NeFL67mNUfOsu+nK1eI3Drfy18j8rFHb0ZTRCDuu2hL9faDkhijG4URnYaGeMZ7mCSxi4FOme9Y9p2pNG3r8hhuazYzioSI4l0dqpSKmzNGkmWQeKyHrxrxemnCt/BaA4XRtrieV7WCiiSELSRbQbVaU4eYFwUSS8pRx4y6T0znX39fuOpdaX+mCMNmDSLaJ/G0Vq5uavJNC11pXjs9Tij3AyvquTl2WKUHu0GOGN4ZAVHUOz8EvQw=----ATTACHMENT:----Mjk2Mjk4NDU2NzE0NDA1NCA3MjI3Njc2NzI4MzUzODkwIDk4OTcyOTY3OTQ0Mjk4ODU=