src/Security/User/PublicUserProvider.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Security\User;
  3. use Symfony\Component\HttpClient\CachingHttpClient;
  4. use Symfony\Component\HttpClient\HttpClient;
  5. use Symfony\Component\HttpKernel\Exception\HttpException;
  6. use Symfony\Component\HttpKernel\HttpCache\Store;
  7. use Lexik\Bundle\JWTAuthenticationBundle\Security\Authentication\Token\PreAuthenticationJWTUserToken;
  8. use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
  9. use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
  10. use Symfony\Component\Security\Core\User\UserInterface;
  11. use Symfony\Component\Security\Core\User\UserProviderInterface;
  12. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  13. /**
  14.  * Description of WebserviceUserProvider.
  15.  *
  16.  * @author aymane
  17.  */
  18. final class PublicUserProvider implements UserProviderInterface
  19. {
  20.     /**
  21.      * {@inheritdoc}
  22.      *
  23.      * @param mixed $username
  24.      * @return PublicUser $use
  25.      *
  26.      * @throws \Exception
  27.      */
  28.     public function loadUserByUsername($username)
  29.     {
  30.         return new PublicUser();
  31.     }
  32.     /**
  33.      * @param UserInterface $user
  34.      * @return UserInterface
  35.      *
  36.      */
  37.     public function refreshUser(UserInterface $user)
  38.     {
  39.         return $user;
  40.     }
  41.     public function supportsClass($class): bool
  42.     {
  43.         return PublicUser::class === $class;
  44.     }
  45. }