8000 [Security] Deprecate legacy remember me services · symfony/symfony@03e5da1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03e5da1

Browse files
wouterjfabpot
authored andcommitted
[Security] Deprecate legacy remember me services
1 parent 7f63fff commit 03e5da1

15 files changed

+48
-3
lines changed

UPGRADE-5.4.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Security
7070
* Deprecate `RetryAuthenticationEntryPoint`, this code is now inlined in the `ChannelListener`
7171
* Deprecate `FormAuthenticationEntryPoint` and `BasicAuthenticationEntryPoint`, in 8000 the new system the `FormLoginAuthenticator`
7272
and `HttpBasicAuthenticator` should be used instead
73+
* Deprecate `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
74+
`TokenBasedRememberMeServices`, use the remember me handler alternatives instead
7375
* Deprecate `AnonymousToken`, as the related authenticator was deprecated in 5.3
7476
* Deprecate `Token::getCredentials()`, tokens should no longer contain credentials (as they represent authenticated sessions)
7577
* Deprecate not returning an `UserInterface` from `Token::getUser()`

UPGRADE-6.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ Security
211211
* Remove the `$authenticationEntryPoint` argument of `ChannelListener`
212212
* Remove `RetryAuthenticationEntryPoint`, this code was inlined in the `ChannelListener`
213213
* Remove `FormAuthenticationEntryPoint` and `BasicAuthenticationEntryPoint`, the `FormLoginAuthenticator` and `HttpBasicAuthenticator` should be used instead.
214+
* Remove `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
215+
`TokenBasedRememberMeServices`, use the remember me handler alternatives instead
214216
* Remove `AnonymousToken`
215217
* Remove `Token::getCredentials()`, tokens should no longer contain credentials (as they represent authenticated sessions)
216218
* Restrict the return type of `Token::getUser()` to `UserInterface` (removing `string|\Stringable`)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ CHANGELOG
88
* Deprecate `RetryAuthenticationEntryPoint`, this code is now inlined in the `ChannelListener`
99
* Deprecate `FormAuthenticationEntryPoint` and `BasicAuthenticationEntryPoint`, in the new system the `FormLoginAuthenticator`
1010
and `HttpBasicAuthenticator` should be used instead
11+
* Deprecate `AbstractRememberMeServices`, `PersistentTokenBasedRememberMeServices`, `RememberMeServicesInterface`,
12+
`TokenBasedRememberMeServices`, use the remember me handler alternatives instead
1113
* Deprecate the `$authManager` argument of `AccessListener`
1214
* Deprecate not setting the `$exceptionOnNoToken` argument of `AccessListener` to `false`
1315
* Deprecate `DeauthenticatedEvent`, use `TokenDeauthenticatedEvent` instead

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

Lines changed: 4 additions & 0 deletions
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.', RememberMeLogoutListener::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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
22< 1241 /code>22
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 3 additions & 0 deletions
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