Skip to content

Commit

Permalink
Deprecate ContaoLoginAuthenticationListener and AuthenticationProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
bytehead committed Nov 14, 2021
1 parent c715261 commit e14a887
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
* @deprecated since Contao 4.13, to be removed in Contao 5.0.
* Use the new authenticator system instead
*/
class ContaoLoginAuthenticationListener extends AbstractAuthenticationListener
{
private TokenStorageInterface $tokenStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;

/**
* @deprecated since Contao 4.13, to be removed in Contao 5.0.
* Use the new authenticator system instead
*/
class AuthenticationProvider extends DaoAuthenticationProvider
{
private UserCheckerInterface $userChecker;
Expand Down
4 changes: 4 additions & 0 deletions core-bundle/tests/PhpunitExtension/DeprecatedClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

use Contao\CoreBundle\DataContainer\PaletteNotFoundException;
use Contao\CoreBundle\DataContainer\PalettePositionException;
use Contao\CoreBundle\Security\Authentication\ContaoLoginAuthenticationListener;
use Contao\CoreBundle\Security\Authentication\Provider\AuthenticationProvider;
use Contao\CoreBundle\Security\Logout\LogoutHandler;
use Contao\CoreBundle\Tests\Fixtures\Image\PictureFactoryWithoutResizeOptionsStub;
use Contao\GdImage;
Expand All @@ -31,6 +33,8 @@ protected function deprecationProvider(): array
PaletteNotFoundException::class => ['%sUsing the "Contao\CoreBundle\Exception\PaletteNotFoundException" class has been deprecated %s.'],
PalettePositionException::class => ['%sUsing the "Contao\CoreBundle\Exception\PalettePositionException" class has been deprecated %s.'],
PictureFactoryWithoutResizeOptionsStub::class => ['%s\PictureFactoryWithoutResizeOptionsStub::create()" method will require a new "ResizeOptions|null $options" argument in the next major version%s'],
ContaoLoginAuthenticationListener::class => ['%sclass extends "Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener"%s'],
AuthenticationProvider::class => ['%sclass extends "Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider"%s'],
];

if (class_exists(LegacyLogoutHandlerListener::class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Contao\CoreBundle\Routing\ScopeMatcher;
use Contao\CoreBundle\Security\Logout\LogoutSuccessHandler;
use Contao\CoreBundle\Tests\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\HttpUtils;
Expand All @@ -25,7 +24,6 @@
*/
class LogoutSuccessHandlerTest extends TestCase
{
use ExpectDeprecationTrait;

public function testRedirectsToAGivenUrl(): void
{
Expand All @@ -47,8 +45,6 @@ public function testRedirectsToAGivenUrl(): void
->willReturn(false)
;

$this->expectDeprecation('Since symfony/security-http 5.1: The "%s" class is deprecated, use "Symfony\Component\Security\Http\EventListener\DefaultLogoutListener" instead.');

$handler = new LogoutSuccessHandler($httpUtils, $scopeMatcher);

/** @var RedirectResponse $response */
Expand Down

0 comments on commit e14a887

Please sign in to comment.