diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2016-03-12 12:14:01 -0500 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2016-03-31 07:33:59 +0200 |
commit | 2a3ff4c385a48668a2595bddb5ecbc45830c03cd (patch) | |
tree | 7dc3a78ebca99626e164ba6357ca28d7be19212b /Guard/Authenticator/AbstractFormLoginAuthenticator.php | |
parent | eb2d9075275e762a5086786449a820b07176f0d0 (diff) | |
download | symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.zip symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.tar.gz symfony-security-2a3ff4c385a48668a2595bddb5ecbc45830c03cd.tar.bz2 |
[Security] Deprecate onAuthenticationSuccess()
Diffstat (limited to 'Guard/Authenticator/AbstractFormLoginAuthenticator.php')
-rw-r--r-- | Guard/Authenticator/AbstractFormLoginAuthenticator.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/Guard/Authenticator/AbstractFormLoginAuthenticator.php index cefafc1..d10e486 100644 --- a/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -36,16 +36,6 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator abstract protected function getLoginUrl(); /** - * The user will be redirected to the secure page they originally tried - * to access. But if no such page exists (i.e. the user went to the - * login page directly), this returns the URL the user should be redirected - * to after logging in successfully (e.g. your homepage). - * - * @return string - */ - abstract protected function getDefaultSuccessRedirectUrl(); - - /** * Override to change what happens after a bad username/password is submitted. * * @param Request $request @@ -72,7 +62,13 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) { - // if the user hit a secure page and start() was called, this was + @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))); + } + + // if the user hits a secure page and start() was called, this was // the URL they were on, and probably where you want to redirect to $targetPath = $this->getTargetPath($request->getSession(), $providerKey); |