10000 [Security] Deprecate legacy remember me services · symfony/symfony@81010f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 81010f9

Browse files
committed
[Security] Deprecate legacy remember me services
1 parent f0b1262 commit 81010f9

15 files changed

+49
-3
lines changed

UPGRADE-5.4.md

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ SecurityBundle
6464
Security
6565
--------
6666

67+
* Deprecate `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
68+
`TokenBasedRememberM 8000 eServices`, use the remember me handler alternatives instead
6769
* Deprecate `AnonymousToken`, as the related authenticator was deprecated in 5.3
6870
* Deprecate `Token::getCredentials()`, tokens should no longer contain credentials (as they represent authenticated sessions)
6971
* Deprecate not returning an `UserInterface` from `Token::getUser()`

UPGRADE-6.0.md

+2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ Routing
208208
Security
209209
--------
210210

211+
* Remove `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
212+
`TokenBasedRememberMeServices`, use the remember me handler alternatives instead
211213
* Remove `AnonymousToken`
212214
* Remove `Token::getCredentials()`, tokens should no longer contain credentials (as they represent authenticated sessions)
213215
* Restrict the return type of `Token::getUser()` to `UserInterface` (removing `string|\Stringable`)

src/Symfony/Component/Security/Http/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
CHANGELOG
22
=========
33

4+
45
5.4
56
---
67

8+
* Deprecate `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
9+
`TokenBasedRememberMeServices`, use the remember me handler alternatives instead
710
* Deprecate the `$authManager` argument of `AccessListener`
811
* Deprecate not setting the `$exceptionOnNoToken` argument of `AccessListener` to `false`
912
* Deprecate `DeauthenticatedEvent`, use `TokenDeauthenticatedEvent` instead

src/Symfony/Component/Security/Http/EventListener/RememberMeLogoutListener.php

+4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
use Symfony\Component\Security\Http\Event\LogoutEvent;
1717
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
1818

19+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated.', __CLASS__);
20+
1921
/**
2022
* @author Wouter de Jong <wouter@wouterj.nl>
2123
*
2224
* @final
25+
*
26+
* @deprecated since Symfony 5.4
2327
*/
2428
class RememberMeLogoutListener implements EventSubscriberInterface
2529
{

src/Symfony/Component/Security/Http/Firewall/ContextListener.php

+5
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,13 @@ public static function handleUnserializeCallback(string $class)
387387
throw new \ErrorException('Class not found: '.$class, 0x37313bc);
388388
}
389389

390+
/**
391+
* @deprecated since Symfony 5.4
392+
*/
390393
public function setRememberMeServices(RememberMeServicesInterface $rememberMeServices)
391394
{
395+
trigger_deprecation('symfony/security-http', '5.4', 'Method "%s()" is deprecated, use the new remember me handlers instead.', __METHOD__);
396+
392397
$this->rememberMeServices = $rememberMeServices;
393398
}
394399
}

src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php

+4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
2727
use Symfony\Component\Security\Http\ParameterBagUtils;
2828

29+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', AbstractRememberMeServices::class, AbstractRememberMeHandler::class);
30+
2931
/**
3032
* Base class implementing the RememberMeServicesInterface.
3133
*
3234
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
35+
*
36+
* @deprecated since Symfony 5.4, use {@see AbstractRememberMeHandler} instead
3337
*/
3438
abstract class AbstractRememberMeServices implements RememberMeServicesInterface, LogoutHandlerInterface
3539
{

src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php

+4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@
2121
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2222
use Symfony\Component\Security\Core\Exception\CookieTheftException;
2323

24+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', PersistentTokenBasedRememberMeServices::class, PersistentRememberMeHandler::class);
25+
2426
/**
2527
* Concrete implementation of the RememberMeServicesInterface which needs
2628
* an implementation of TokenProviderInterface for providing remember-me
2729
* capabilities.
2830
*
2931
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
32+
*
33+
* @deprecated since Symfony 5.4, use {@see PersistentRememberMeHandler} instead
3034
*/
3135
class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices
3236
{

src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1717

18+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" interface is deprecated, use "%s" instead.', RememberMeServicesInterface::class, RememberMeHandlerInterface::class);
19+
1820
/**
1921
* Interface that needs to be implemented by classes which provide remember-me
2022
* capabilities.
@@ -26,6 +28,8 @@
2628
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2729
*
2830
* @method logout(Request $request, Response $response, TokenInterface $token)
31+
*
32+
* @deprecated since Symfony 5.4, use {@see RememberMeHandlerInterface} instead
2933
*/
3034
interface RememberMeServicesInterface
3135
{

src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php

+4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1919
use Symfony\Component\Security\Core\User\UserInterface;
2020

21+
trigger_deprecation('symfony/security-http', '5.4', 'The "%s" class is deprecated, use "%s" instead.', TokenBasedRememberMeServices::class, SignatureRememberMeHandler::class);
22+
2123
/**
2224
* Concrete implementation of the RememberMeServicesInterface providing
2325
* remember-me capabilities without requiring a TokenProvider.
2426
*
2527
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
28+
*
29+
* @deprecated since Symfony 5.4, use {@see SignatureRememberMeHandler} instead
2630
*/
2731
class TokenBasedRememberMeServices extends AbstractRememberMeServices
2832
{

src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeLogoutListenerTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use Symfony\Component\Security\Http\EventListener\RememberMeLogoutListener;
1818
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
1919

20+
/**
21+
* @group legacy
22+
*/
2023
class RememberMeLogoutListenerTest extends TestCase
2124
{
2225
public function testOnLogoutDoesNothingIfNoToken()

src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ public function testIfTokenIsNotDeauthenticated()
242242
$this->assertSame($goodRefreshedUser, $tokenStorage->getToken()->getUser());
243243
}
244244

245+
/**
246+
* @group legacy
247+
*/
245248
public function testRememberMeGetsCanceledIfTokenIsDeauthenticated()
246249
{
247250
$tokenStorage = new TokenStorage();

src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
2222
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
2323

24+
/**
25+
* @group legacy
26+
*/
2427
class AbstractRememberMeServicesTest extends TestCase
2528
{
2629
public function testGetRememberMeParameter()

src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices;
2929
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
3030

31+
/**
32+
* @group legacy
33+
*/
3134
class PersistentTokenBasedRememberMeServicesTest extends TestCase
3235
{
3336
public static function setUpBeforeClass(): void

src/Symfony/Component/Security/Http/Tests/RememberMe/ResponseListenerTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2020
use Symfony\Component\HttpKernel\HttpKernelInterface;
2121
use Symfony\Component\HttpKernel\KernelEvents;
22-
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
2322
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
2423

2524
class ResponseListenerTest extends TestCase
@@ -29,7 +28,7 @@ public function testRememberMeCookieIsSentWithResponse()
2928
$cookie = new Cookie('rememberme', null, 0, '/', null, false, true, false, null);
3029

3130
$request = $this->getRequest([
32-
RememberMeServicesInterface::COOKIE_ATTR_NAME => $cookie,
31+
ResponseListener::COOKIE_ATTR_NAME => $cookie,
3332
]);
3433

3534
$response = $this->getResponse();
@@ -44,7 +43,7 @@ public function testRememberMeCookieIsNotSendWithResponseForSubRequests()
4443
$cookie = new Cookie('rememberme', null, 0, '/', null, false, true, false, null);
4544

4645
$request = $this->getRequest([
47-
RememberMeServicesInterface::COOKIE_ATTR_NAME => $cookie,
46+
ResponseListener::COOKIE_ATTR_NAME => $cookie,
4847
]);
4948

5049
$response = $this->getResponse();

src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
2424
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
2525

26+
/**
27+
* @group legacy
28+
*/
2629
class TokenBasedRememberMeServicesTest extends TestCase
2730
{
2831
public function testAutoLoginReturnsNullWhenNoCookie()

0 commit comments

Comments
 (0)
0