vendor/symfony/symfony/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php line 30

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\Guard;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\Security\Core\User\UserInterface;
  13. use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
  14. /**
  15.  * An optional base class that creates a PostAuthenticationGuardToken for you.
  16.  *
  17.  * @author Ryan Weaver <ryan@knpuniversity.com>
  18.  */
  19. abstract class AbstractGuardAuthenticator implements AuthenticatorInterface
  20. {
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function supports(Request $request)
  25.     {
  26.         @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Implement the "%s::supports()" method in class "%s" instead.'__METHOD__AuthenticatorInterface::class, static::class), \E_USER_DEPRECATED);
  27.         return true;
  28.     }
  29.     /**
  30.      * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really
  31.      * care about which authenticated token you're using.
  32.      *
  33.      * @param string $providerKey
  34.      *
  35.      * @return PostAuthenticationGuardToken
  36.      */
  37.     public function createAuthenticatedToken(UserInterface $user$providerKey)
  38.     {
  39.         return new PostAuthenticationGuardToken(
  40.             $user,
  41.             $providerKey,
  42.             $user->getRoles()
  43.         );
  44.     }
  45. }