Skip to content

Commit

Permalink
[Security] Deprecate the old authentication mechanisms
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr committed May 18, 2021
1 parent 78a6e3a commit b19fe50
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions AbstractGuardAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* An optional base class that creates a PostAuthenticationGuardToken for you.
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
abstract class AbstractGuardAuthenticator implements AuthenticatorInterface
{
Expand Down
3 changes: 3 additions & 0 deletions Authenticator/AbstractFormLoginAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;

/**
* A base class to make form login authentication easier!
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
{
Expand Down
4 changes: 4 additions & 0 deletions Authenticator/GuardBridgeAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@
use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardBridgeAuthenticator::class);

/**
* This authenticator is used to bridge Guard authenticators with
* the Symfony Authenticator system.
*
* @author Wouter de Jong <[email protected]>
*
* @internal
*
* @deprecated since Symfony 5.3
*/
class GuardBridgeAuthenticator implements InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface
{
Expand Down
2 changes: 2 additions & 0 deletions AuthenticatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*
* @author Ryan Weaver <[email protected]>
* @author Amaury Leroux de Lens <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
interface AuthenticatorInterface extends AuthenticationEntryPointInterface
{
Expand Down
4 changes: 4 additions & 0 deletions Firewall/GuardAuthenticationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
use Symfony\Component\Security\Http\Firewall\AbstractListener;
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticationListener::class);

/**
* Authentication listener for the "guard" system.
*
* @author Ryan Weaver <[email protected]>
* @author Amaury Leroux de Lens <[email protected]>
*
* @final
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
class GuardAuthenticationListener extends AbstractListener
{
Expand Down
4 changes: 4 additions & 0 deletions GuardAuthenticatorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticatorHandler::class);

/**
* A utility class that does much of the *work* during the guard authentication process.
*
Expand All @@ -31,6 +33,8 @@
* @author Ryan Weaver <[email protected]>
*
* @final
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
class GuardAuthenticatorHandler
{
Expand Down
4 changes: 4 additions & 0 deletions PasswordAuthenticatedInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@

namespace Symfony\Component\Security\Guard;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PasswordAuthenticatedInterface::class);

/**
* An optional interface for "guard" authenticators that deal with user passwords.
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
interface PasswordAuthenticatedInterface
{
Expand Down
4 changes: 4 additions & 0 deletions Provider/GuardAuthenticationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardAuthenticationProvider::class);

/**
* Responsible for accepting the PreAuthenticationGuardToken and calling
* the correct authenticator to retrieve the authenticated token.
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
class GuardAuthenticationProvider implements AuthenticationProviderInterface
{
Expand Down
1 change: 1 addition & 0 deletions Tests/Authenticator/FormLoginAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/**
* @author Jean Pasdeloup <[email protected]>
* @group legacy
*/
class FormLoginAuthenticatorTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions Tests/Authenticator/GuardBridgeAuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;

/**
* @group legacy
*/
class GuardBridgeAuthenticatorTest extends TestCase
{
private $guardAuthenticator;
Expand Down
1 change: 1 addition & 0 deletions Tests/Firewall/GuardAuthenticationListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
/**
* @author Ryan Weaver <[email protected]>
* @author Amaury Leroux de Lens <[email protected]>
* @group legacy
*/
class GuardAuthenticationListenerTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions Tests/GuardAuthenticatorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
* @group legacy
*/
class GuardAuthenticatorHandlerTest extends TestCase
{
private $tokenStorage;
Expand Down
1 change: 1 addition & 0 deletions Tests/Provider/GuardAuthenticationProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

/**
* @author Ryan Weaver <[email protected]>
* @group legacy
*/
class GuardAuthenticationProviderTest extends TestCase
{
Expand Down
4 changes: 4 additions & 0 deletions Token/GuardTokenInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', GuardTokenInterface::class);

/**
* A marker interface that both guard tokens implement.
*
Expand All @@ -21,6 +23,8 @@
* interface.
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
interface GuardTokenInterface extends TokenInterface
{
Expand Down
4 changes: 4 additions & 0 deletions Token/PostAuthenticationGuardToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
use Symfony\Component\Security\Core\User\UserInterface;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PostAuthenticationGuardToken::class);

/**
* Used as an "authenticated" token, though it could be set to not-authenticated later.
*
* If you're using Guard authentication, you *must* use a class that implements
* GuardTokenInterface as your authenticated token (like this class).
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
class PostAuthenticationGuardToken extends AbstractToken implements GuardTokenInterface
{
Expand Down
4 changes: 4 additions & 0 deletions Token/PreAuthenticationGuardToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;

trigger_deprecation('symfony/security-guard', '5.3', 'The "%s" class is deprecated, use the new authenticator system instead.', PreAuthenticationGuardToken::class);

/**
* The token used by the guard auth system before authentication.
*
Expand All @@ -21,6 +23,8 @@
* successful, a different authenticated token is returned
*
* @author Ryan Weaver <[email protected]>
*
* @deprecated since Symfony 5.3, use the new authenticator system instead
*/
class PreAuthenticationGuardToken extends AbstractToken implements GuardTokenInterface
{
Expand Down

0 comments on commit b19fe50

Please sign in to comment.