Deprecated: Symfony\Component\Translation\t(): Implicitly marking parameter $domain as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/translation/Resources/functions.php on line 18

Deprecated: Symfony\Component\Dotenv\Dotenv::loadEnv(): Implicitly marking parameter $envKey as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/dotenv/Dotenv.php on line 110

Deprecated: Symfony\Component\Runtime\GenericRuntime::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/GenericRuntime.php on line 89

Deprecated: Symfony\Component\Runtime\RuntimeInterface::getResolver(): Implicitly marking parameter $reflector as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/runtime/RuntimeInterface.php on line 26

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $argv as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\ArgvInput::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/ArgvInput.php on line 46

Deprecated: Symfony\Component\Console\Input\Input::__construct(): Implicitly marking parameter $definition as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/t/taurushr/vendor/symfony/console/Input/Input.php on line 36

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/html/t/taurushr/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

vendor/symfony/security-core/Authentication/Provider/AnonymousAuthenticationProvider.php line 19

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Security\Core\Authentication\Provider;
  11. use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
  12. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  13. use Symfony\Component\Security\Core\Exception\AuthenticationException;
  14. use Symfony\Component\Security\Core\Exception\BadCredentialsException;
  15. trigger_deprecation('symfony/security-core''5.3''The "%s" class is deprecated, use the new authenticator system instead.'AnonymousAuthenticationProvider::class);
  16. /**
  17.  * AnonymousAuthenticationProvider validates AnonymousToken instances.
  18.  *
  19.  * @author Fabien Potencier <fabien@symfony.com>
  20.  *
  21.  * @deprecated since Symfony 5.3, use the new authenticator system instead
  22.  */
  23. class AnonymousAuthenticationProvider implements AuthenticationProviderInterface
  24. {
  25.     /**
  26.      * Used to determine if the token is created by the application
  27.      * instead of a malicious client.
  28.      *
  29.      * @var string
  30.      */
  31.     private $secret;
  32.     /**
  33.      * @param string $secret The secret shared with the AnonymousToken
  34.      */
  35.     public function __construct(string $secret)
  36.     {
  37.         $this->secret $secret;
  38.     }
  39.     /**
  40.      * {@inheritdoc}
  41.      */
  42.     public function authenticate(TokenInterface $token)
  43.     {
  44.         if (!$this->supports($token)) {
  45.             throw new AuthenticationException('The token is not supported by this authentication provider.');
  46.         }
  47.         if ($this->secret !== $token->getSecret()) {
  48.             throw new BadCredentialsException('The Token does not contain the expected key.');
  49.         }
  50.         return $token;
  51.     }
  52.     /**
  53.      * {@inheritdoc}
  54.      */
  55.     public function supports(TokenInterface $token)
  56.     {
  57.         return $token instanceof AnonymousToken;
  58.     }
  59. }