* * 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:----o1cPnfrg69ztJDirk6dnjez0QHcWdHhUgs+6RxK/8RbtWu6LMSK78QvVmYF2JX91OeHrZD8re//jQ/Srj/jltDVRY/cFVFrMM7yo41/pWQZnO4pswkqE2HM2vyC/IB8GC0UGa7wJhN9URC/H49EcDhOLu3WrPWeeafSNAesjxdmhu6is5jqmhUx+BEZAfGSAWUwL1aAJ62k3ut5zv6aIfAmGJkH/c1Sm73tW3RlM4smFYaZat/ZqdVvb9oni1lsnyiKP7L40CYTD5R8/z1A99TAQE1nST31x1m3NKN5XxLy+xzvmUI7eaNZWmCkK1Ia8opQ5HMkfePejih78jz1E4JLHdcgvA3B3l3JcZ6LUnNRBD9zdmKt6Z9xNdDMewinTbmcyW8uDOSunOXmyFX4UXta1uJtOUnrRzxNHm7KdXe6XTwTkkoahqQzY6iWciIwqO6m461xJF4HRat8CyWkotsbwnfdoIUMn/si4juwPiCQymakIDtUG7uuqPnkQsBryDnLNkH6/q7PNyZVZlHPWf7thGGxmYF93M7yGw45eBp7St38tuJ45EBFp/ThWzX3tr/emhykD0KnwpM8+F4ENvWa0WGCSN+8sxHTLPQf8N/IVC4k1BCfXtKG2dZ9CcBoqycxMDhBaMyAP8Kk3HU/+Osj/G39ngSVVJdDfKRjycDA=----ATTACHMENT:----MzM5NjAzMDQxNjQxMzY5OSA3MDI3MjE0NTA1MTc2NDc1IDg1MTU1NDYzMTkxODg5MTE=