-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #18135 [Security] Deprecate onAuthenticationSuccess() (weaver…
…ryan) This PR was squashed before being merged into the 3.1-dev branch (closes #18135). Discussion ---------- [Security] Deprecate onAuthenticationSuccess() | Q | A | ------------- | --- | Branch | master | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #18027 | License | MIT | Doc PR | not yet - the existing feature is not currently documented Because of the new `TargetPathTrait`, implementing `onAuthenticationSuccess` yourself is quite easy. I think we should just remove it. This also will fix #18027. Thanks! Commits ------- c4ae80a [Security] Deprecate onAuthenticationSuccess()
- Loading branch information
Showing
2 changed files
with
71 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...mfony/Component/Security/Guard/Tests/Authenticator/AbstractFormLoginAuthenticatorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Security\Guard\Tests\Authenticator; | ||
|
||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Security\Core\User\UserInterface; | ||
use Symfony\Component\Security\Core\User\UserProviderInterface; | ||
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator; | ||
|
||
class AbstractFormLoginAuthenticatorTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @group legacy | ||
*/ | ||
public function testLegacyWithLoginUrl() | ||
{ | ||
$request = new Request(); | ||
$request->setSession($this->getMock('Symfony\Component\HttpFoundation\Session\Session')); | ||
|
||
$authenticator = new LegacyFormLoginAuthenticator(); | ||
/** @var RedirectResponse $actualResponse */ | ||
$actualResponse = $authenticator->onAuthenticationSuccess( | ||
$request, | ||
$this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'), | ||
'provider_key' | ||
); | ||
|
||
$this->assertEquals('/default_url', $actualResponse->getTargetUrl()); | ||
} | ||
} | ||
|
||
class LegacyFormLoginAuthenticator extends AbstractFormLoginAuthenticator | ||
{ | ||
protected function getDefaultSuccessRedirectUrl() | ||
{ | ||
return '/default_url'; | ||
} | ||
|
||
protected function getLoginUrl() | ||
{ | ||
} | ||
|
||
public function getCredentials(Request $request) | ||
{ | ||
} | ||
|
||
public function getUser($credentials, UserProviderInterface $userProvider) | ||
{ | ||
} | ||
|
||
public function checkCredentials($credentials, UserInterface $user) | ||
{ | ||
} | ||
} |