vendor/symfony/security-guard/AbstractGuardAuthenticator.php line 34

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\Security\Core\User\UserInterface;
  12. use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken;
  13. /**
  14.  * An optional base class that creates a PostAuthenticationGuardToken for you.
  15.  *
  16.  * @author Ryan Weaver <ryan@knpuniversity.com>
  17.  *
  18.  * @deprecated since Symfony 5.3, use the new authenticator system instead
  19.  */
  20. abstract class AbstractGuardAuthenticator implements AuthenticatorInterface
  21. {
  22.     /**
  23.      * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really
  24.      * care about which authenticated token you're using.
  25.      *
  26.      * @return PostAuthenticationGuardToken
  27.      */
  28.     public function createAuthenticatedToken(UserInterface $userstring $providerKey)
  29.     {
  30.         return new PostAuthenticationGuardToken(
  31.             $user,
  32.             $providerKey,
  33.             $user->getRoles()
  34.         );
  35.     }
  36. }