minor #41554 Fix Serializable deprecations triggered by token mocks (derrabus)
This PR was merged into the 4.4 branch.
Discussion
----------
Fix Serializable deprecations triggered by token mocks
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Part of #41552
| License | MIT
| Doc PR | N/A
On 4.4, `TokenInterface` extends `Serializable` but does not enforce implementations to implement `__serialize()` as well. When creating a mock from this interface, PHPUnit will emit code that triggers a deprecation warning on PHP 8.1.
This PR introduces stricter versions of `TokenInterface` to work around that problem.
My goal was to keep the diff small and mergable. We can probably drop most of the changes when merging to 5.2 because the two methods have been added there.
Commits
-------
48e76fafc6
Fix Serializable deprecations triggered by token mocks
This commit is contained in:
commit
ec80d3c5ad
@ -4,12 +4,12 @@ namespace Symfony\Bridge\Twig\Tests;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bridge\Twig\AppVariable;
|
use Symfony\Bridge\Twig\AppVariable;
|
||||||
|
use Symfony\Bridge\Twig\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
class AppVariableTest extends TestCase
|
class AppVariableTest extends TestCase
|
||||||
|
11
src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php
Normal file
11
src/Symfony/Bridge/Twig/Tests/Fixtures/TokenInterface.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Bridge\Twig\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -12,10 +12,10 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
|
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\SecurityBundle\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
|
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
|
||||||
|
|
||||||
|
use Symfony\Bundle\SecurityBundle\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
use Symfony\Component\Security\Core\AuthenticationEvents;
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||||
|
@ -13,12 +13,12 @@ namespace Symfony\Bundle\SecurityBundle\Tests;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\SecurityBundle\SecurityUserValueResolver;
|
use Symfony\Bundle\SecurityBundle\SecurityUserValueResolver;
|
||||||
|
use Symfony\Bundle\SecurityBundle\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
|
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
|
||||||
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver;
|
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver;
|
||||||
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
|
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,7 +15,6 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
|
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
use Symfony\Component\Security\Core\AuthenticationEvents;
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent;
|
||||||
@ -23,6 +22,7 @@ use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
|||||||
use Symfony\Component\Security\Core\Exception\AccountStatusException;
|
use Symfony\Component\Security\Core\Exception\AccountStatusException;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\ProviderNotFoundException;
|
use Symfony\Component\Security\Core\Exception\ProviderNotFoundException;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AuthenticationProviderManagerTest extends TestCase
|
class AuthenticationProviderManagerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AuthenticationTrustResolverTest extends TestCase
|
class AuthenticationTrustResolverTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -14,9 +14,9 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AnonymousAuthenticationProviderTest extends TestCase
|
class AnonymousAuthenticationProviderTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -13,10 +13,10 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||||
use Symfony\Component\Security\Core\Exception\LockedException;
|
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
|
@ -14,11 +14,11 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||||
use Symfony\Component\Security\Core\Exception\DisabledException;
|
use Symfony\Component\Security\Core\Exception\DisabledException;
|
||||||
use Symfony\Component\Security\Core\Exception\LogicException;
|
use Symfony\Component\Security\Core\Exception\LogicException;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\User;
|
use Symfony\Component\Security\Core\User\User;
|
||||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
@ -14,9 +14,9 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\DisabledException;
|
use Symfony\Component\Security\Core\Exception\DisabledException;
|
||||||
use Symfony\Component\Security\Core\Exception\LockedException;
|
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserChecker;
|
use Symfony\Component\Security\Core\User\UserChecker;
|
||||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Security\Core\Tests\Authentication\Provider;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider;
|
use Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
|
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
|
use Symfony\Component\Security\Core\Exception\AccountExpiredException;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
@ -23,6 +22,7 @@ use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
|||||||
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
|
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
|
||||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ use Psr\Container\ContainerInterface;
|
|||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Contracts\Service\ServiceLocatorTrait;
|
use Symfony\Contracts\Service\ServiceLocatorTrait;
|
||||||
|
|
||||||
class UsageTrackingTokenStorageTest extends TestCase
|
class UsageTrackingTokenStorageTest extends TestCase
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Authorization;
|
namespace Symfony\Component\Security\Core\Tests\Authorization;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
|
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AccessDecisionManagerTest extends TestCase
|
class AccessDecisionManagerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Authorization;
|
namespace Symfony\Component\Security\Core\Tests\Authorization;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
|
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
|
||||||
use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager;
|
use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager;
|
||||||
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
|
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class TraceableAccessDecisionManagerTest extends TestCase
|
class TraceableAccessDecisionManagerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,9 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
|
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AuthenticatedVoterTest extends TestCase
|
class AuthenticatedVoterTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,12 +15,12 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\ExpressionLanguage\Expression;
|
use Symfony\Component\ExpressionLanguage\Expression;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
|
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter;
|
use Symfony\Component\Security\Core\Authorization\Voter\ExpressionVoter;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class ExpressionVoterTest extends TestCase
|
class ExpressionVoterTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -13,10 +13,10 @@ namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
|
|||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter;
|
use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class RoleVoterTest extends TestCase
|
class RoleVoterTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
|
namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter;
|
use Symfony\Component\Security\Core\Authorization\Voter\TraceableVoter;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
use Symfony\Component\Security\Core\Event\VoteEvent;
|
use Symfony\Component\Security\Core\Event\VoteEvent;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
class TraceableVoterTest extends TestCase
|
class TraceableVoterTest extends TestCase
|
||||||
|
@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface as StrictTokenInterface;
|
||||||
|
|
||||||
class VoterTest extends TestCase
|
class VoterTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -22,7 +23,7 @@ class VoterTest extends TestCase
|
|||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->token = $this->createMock(TokenInterface::class);
|
$this->token = $this->createMock(StrictTokenInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTests()
|
public function getTests()
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\Security\Core\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -12,8 +12,8 @@
|
|||||||
namespace Symfony\Component\Security\Core\Tests\Role;
|
namespace Symfony\Component\Security\Core\Tests\Role;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
use Symfony\Component\Security\Core\Role\SwitchUserRole;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
@ -14,10 +14,10 @@ namespace Symfony\Component\Security\Core\Tests;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\User;
|
use Symfony\Component\Security\Core\User\User;
|
||||||
|
|
||||||
class SecurityTest extends TestCase
|
class SecurityTest extends TestCase
|
||||||
|
@ -13,9 +13,9 @@ namespace Symfony\Component\Security\Core\Tests\Validator\Constraints;
|
|||||||
|
|
||||||
use Foo\Bar\User;
|
use Foo\Bar\User;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||||
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
|
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
|
||||||
|
use Symfony\Component\Security\Core\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
|
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
|
||||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator;
|
use Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator;
|
||||||
|
@ -17,7 +17,6 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||||
use Symfony\Component\Security\Core\Exception\LockedException;
|
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||||
@ -25,6 +24,7 @@ use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
|||||||
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener;
|
use Symfony\Component\Security\Guard\Firewall\GuardAuthenticationListener;
|
||||||
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
|
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
|
||||||
|
use Symfony\Component\Security\Guard\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;
|
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\Security\Guard\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Guard\Token\GuardTokenInterface as BaseGuardTokenInterface;
|
||||||
|
|
||||||
|
interface GuardTokenInterface extends BaseGuardTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\Security\Guard\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -16,10 +16,10 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
|
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
|
||||||
|
use Symfony\Component\Security\Guard\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||||
use Symfony\Component\Security\Http\SecurityEvents;
|
use Symfony\Component\Security\Http\SecurityEvents;
|
||||||
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
||||||
|
@ -20,7 +20,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
use Symfony\Component\Security\Guard\AuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider;
|
use Symfony\Component\Security\Guard\Provider\GuardAuthenticationProvider;
|
||||||
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
|
use Symfony\Component\Security\Guard\Tests\Fixtures\GuardTokenInterface;
|
||||||
use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
|
use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
|
||||||
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;
|
use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken;
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
|
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;
|
||||||
use Symfony\Component\Security\Http\HttpUtils;
|
use Symfony\Component\Security\Http\HttpUtils;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class DefaultAuthenticationSuccessHandlerTest extends TestCase
|
class DefaultAuthenticationSuccessHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,11 +15,11 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
use Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
|
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
|
||||||
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
|
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
|
||||||
use Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler;
|
use Symfony\Component\Security\Http\Authentication\SimpleAuthenticationHandler;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
@ -17,10 +17,10 @@ use Symfony\Component\HttpKernel\Event\RequestEvent;
|
|||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener;
|
use Symfony\Component\Security\Http\Firewall\AbstractPreAuthenticatedListener;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AbstractPreAuthenticatedListenerTest extends TestCase
|
class AbstractPreAuthenticatedListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -18,13 +18,13 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
|
||||||
use Symfony\Component\Security\Http\AccessMapInterface;
|
use Symfony\Component\Security\Http\AccessMapInterface;
|
||||||
use Symfony\Component\Security\Http\Event\LazyResponseEvent;
|
use Symfony\Component\Security\Http\Event\LazyResponseEvent;
|
||||||
use Symfony\Component\Security\Http\Firewall\AccessListener;
|
use Symfony\Component\Security\Http\Firewall\AccessListener;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AccessListenerTest extends TestCase
|
class AccessListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -19,8 +19,8 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;
|
use Symfony\Component\Security\Http\Firewall\AnonymousAuthenticationListener;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AnonymousAuthenticationListenerTest extends TestCase
|
class AnonymousAuthenticationListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,11 @@ use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager
|
|||||||
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
|
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||||
use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener;
|
use Symfony\Component\Security\Http\Firewall\BasicAuthenticationListener;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class BasicAuthenticationListenerTest extends TestCase
|
class BasicAuthenticationListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
|||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Core\Exception\LogoutException;
|
use Symfony\Component\Security\Core\Exception\LogoutException;
|
||||||
@ -27,6 +26,7 @@ use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
|
|||||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||||
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
|
use Symfony\Component\Security\Http\Firewall\ExceptionListener;
|
||||||
use Symfony\Component\Security\Http\HttpUtils;
|
use Symfony\Component\Security\Http\HttpUtils;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class ExceptionListenerTest extends TestCase
|
class ExceptionListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -16,13 +16,13 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\LogoutException;
|
use Symfony\Component\Security\Core\Exception\LogoutException;
|
||||||
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
||||||
use Symfony\Component\Security\Http\Firewall\LogoutListener;
|
use Symfony\Component\Security\Http\Firewall\LogoutListener;
|
||||||
use Symfony\Component\Security\Http\HttpUtils;
|
use Symfony\Component\Security\Http\HttpUtils;
|
||||||
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
|
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
|
||||||
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
|
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class LogoutListenerTest extends TestCase
|
class LogoutListenerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,13 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
|||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||||
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
|
use Symfony\Component\Security\Http\Firewall\RememberMeListener;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
use Symfony\Component\Security\Http\SecurityEvents;
|
use Symfony\Component\Security\Http\SecurityEvents;
|
||||||
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
class RememberMeListenerTest extends TestCase
|
class RememberMeListenerTest extends TestCase
|
||||||
|
@ -18,12 +18,12 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||||
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface;
|
use Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface;
|
||||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||||
use Symfony\Component\Security\Http\Firewall\SimplePreAuthenticationListener;
|
use Symfony\Component\Security\Http\Firewall\SimplePreAuthenticationListener;
|
||||||
use Symfony\Component\Security\Http\SecurityEvents;
|
use Symfony\Component\Security\Http\SecurityEvents;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group legacy
|
* @group legacy
|
||||||
|
@ -28,6 +28,7 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerI
|
|||||||
use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener;
|
use Symfony\Component\Security\Http\Firewall\UsernamePasswordJsonAuthenticationListener;
|
||||||
use Symfony\Component\Security\Http\HttpUtils;
|
use Symfony\Component\Security\Http\HttpUtils;
|
||||||
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface as StrictTokenInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||||
@ -50,7 +51,7 @@ class UsernamePasswordJsonAuthenticationListenerTest extends TestCase
|
|||||||
;
|
;
|
||||||
$authenticationManager = $this->createMock(AuthenticationManagerInterface::class);
|
$authenticationManager = $this->createMock(AuthenticationManagerInterface::class);
|
||||||
|
|
||||||
$authenticatedToken = $this->createMock(TokenInterface::class);
|
$authenticatedToken = $this->createMock(StrictTokenInterface::class);
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$authenticationManager->method('authenticate')->willReturn($authenticatedToken);
|
$authenticationManager->method('authenticate')->willReturn($authenticatedToken);
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\Security\Http\Tests\Fixtures;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface as BaseTokenInterface;
|
||||||
|
|
||||||
|
interface TokenInterface extends BaseTokenInterface
|
||||||
|
{
|
||||||
|
public function __serialize(): array;
|
||||||
|
public function __unserialize(array $data): void;
|
||||||
|
}
|
@ -16,8 +16,8 @@ use Symfony\Component\HttpFoundation\Cookie;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler;
|
use Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class CookieClearingLogoutHandlerTest extends TestCase
|
class CookieClearingLogoutHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -16,9 +16,9 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
|
use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage;
|
||||||
use Symfony\Component\Security\Http\Logout\CsrfTokenClearingLogoutHandler;
|
use Symfony\Component\Security\Http\Logout\CsrfTokenClearingLogoutHandler;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class CsrfTokenClearingLogoutHandlerTest extends TestCase
|
class CsrfTokenClearingLogoutHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,8 +15,8 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Logout\SessionLogoutHandler;
|
use Symfony\Component\Security\Http\Logout\SessionLogoutHandler;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class SessionLogoutHandlerTest extends TestCase
|
class SessionLogoutHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -15,11 +15,11 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use Symfony\Component\HttpFoundation\Cookie;
|
use Symfony\Component\HttpFoundation\Cookie;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
|
use Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class AbstractRememberMeServicesTest extends TestCase
|
class AbstractRememberMeServicesTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,6 @@ use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
|||||||
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
|
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
|
use Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\CookieTheftException;
|
use Symfony\Component\Security\Core\Exception\CookieTheftException;
|
||||||
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
|
use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
|
||||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
@ -27,6 +26,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices;
|
use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class PersistentTokenBasedRememberMeServicesTest extends TestCase
|
class PersistentTokenBasedRememberMeServicesTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -17,12 +17,12 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
|
||||||
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
|
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class TokenBasedRememberMeServicesTest extends TestCase
|
class TokenBasedRememberMeServicesTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@ -14,8 +14,8 @@ namespace Symfony\Component\Security\Http\Tests\Session;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
|
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
|
||||||
|
use Symfony\Component\Security\Http\Tests\Fixtures\TokenInterface;
|
||||||
|
|
||||||
class SessionAuthenticationStrategyTest extends TestCase
|
class SessionAuthenticationStrategyTest extends TestCase
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user