title: Symfony4 Authentication request could not be processed due to a system problem
body: <p>I’m currently discovering symfony.I am trying to code some user account. There are two role : ADMIN_ROLE or USER_ROLE. When I try to connect an account, I have this message  « Authentication request could not be processed due to a system problem. » even when I enter a wrong username/password !
  I have been looking for a solution for days (in docs and on internet). </p>
  
  <p>I can fill my database with my user thanks to the fixture (I can see it in SQLyog). I tried to erase ma database to create it again. </p>
  
  <p>This is my security.yaml :</p>
  
  <pre><code># https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
  providers:
      # used to reload user from session &amp; other features (e.g. switch_user)
      app_user_provider:
          entity:
              class: App\Entity\User
              property: username
  firewalls:
      dev:
          pattern: ^/(_(profiler|wdt)|css|images|js)/
          security: false
      main:
          anonymous: ~
  
          form_login:
              login_path: login
              check_path: login
  
          logout:
              path: app_logout
  
          # activate different ways to authenticate
          # https://symfony.com/doc/current/security.html#firewalls-authentication
  
          # https://symfony.com/doc/current/security/impersonating_user.html
          # switch_user: true
  
  # Easy way to control access for large sections of your site
  # Note: Only the *first* access control that matches will be used
  access_control:
      - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY  }
      - { path: ^/admin, roles: ROLE_ADMIN }
      - { path: ^/, roles: ROLE_USER }
  
  
  </code></pre>
  
  <p>This is my UtilisateurFixtures (to create false data)</p>
  
  <pre><code>&lt;?php
  namespace App\DataFixtures;
  use App\Entity\Utilisateur;
  use Doctrine\Bundle\FixturesBundle\Fixture;
  use Doctrine\Common\Persistence\ObjectManager;
  use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  use Symfony\Component\Security\Core\User\User;
  //use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
  class UtilisateurFixtures extends Fixture
  {
  /**
  * @var UserPasswordEncoderInterface
  */
  private $encoder;
  
  public function __construct(UserPasswordEncoderInterface $encoder)
  {
      $this-&gt;encoder = $encoder;
  }
  
  public function load(ObjectManager $manager)
  {
  
      $user = new Utilisateur();
      $user-&gt;setUsername('demo3');
      $user-&gt;setPassword($this-&gt;encoder-&gt;encodePassword($user,'demo3'));
      $user-&gt;setRoles(['ROLE_USER', 'ROLE_ADMIN']);
      $manager-&gt;persist($user);
  
      $manager-&gt;flush();
  }
  }
  </code></pre>
  
  <p>This is my SecurityController :</p>
  
  <pre><code>&lt;?php
  namespace App\Controller;
  use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\Routing\Annotation\Route;
  use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  class SecurityController extends AbstractController
  {
  /**
  * @Route("/login", name="login")
  */
  public function login(AuthenticationUtils $authenticationUtils): Response
  {
  // get the login error if there is one
  $error = $authenticationUtils-&gt;getLastAuthenticationError();
  // last username entered by the user
  $lastUsername = $authenticationUtils-&gt;getLastUsername();
      return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
  }
  
  /**
   * @Route("/logout", name="app_logout", methods={"GET"})
   */
  public function logout()
  {
      // controller can be blank: it will never be executed!
      throw new \Exception('Don\'t forget to activate logout in security.yaml');
  }
  }
  </code></pre>
  
  <p>This is my Utilisateur.php :</p>
  
  <pre><code>&lt;?php
  namespace App\DataFixtures;
  use App\Entity\Utilisateur;
  use Doctrine\Bundle\FixturesBundle\Fixture;
  use Doctrine\Common\Persistence\ObjectManager;
  use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  use Symfony\Component\Security\Core\User\User;
  //use Symfony\Bridge\Doctrine\Tests\Fixtures\User;
  class UtilisateurFixtures extends Fixture
  {
  /**
  * @var UserPasswordEncoderInterface
  */
  private $encoder;
  
  public function __construct(UserPasswordEncoderInterface $encoder)
  {
      $this-&gt;encoder = $encoder;
  }
  
  public function load(ObjectManager $manager)
  {
  
      $user = new Utilisateur();
      $user-&gt;setUsername('demo3');
      $user-&gt;setPassword($this-&gt;encoder-&gt;encodePassword($user,'demo3'));
      $user-&gt;setRoles(['ROLE_USER', 'ROLE_ADMIN']);
      $manager-&gt;persist($user);
  
      $manager-&gt;flush();
  }
  }
  </code></pre>
  
  <p>This is my login.htlml.twig (where there is my form) :</p>
  
  <pre><code>{% extends 'base.html.twig' %}
  {% block title %}Log in!{% endblock %}
  {% block body %}{% if error %}
  {{ error.messageKey|trans(error.messageData, 'security') }}
  {% endif %}
  &lt;form action="{{ path('login') }}" method="post"&gt;
      &lt;label for="username"&gt;Username:&lt;/label&gt;
      &lt;input type="text" id="username" name="_username" value="{{ last_username }}" /&gt;
  
      &lt;label for="password"&gt;Password:&lt;/label&gt;
      &lt;input type="password" id="password" name="_password" /&gt;
  
      &lt;input type="hidden" name="_target_path" value="/" /&gt;
  
      {#
          If you want to control the URL the user
          is redirected to on success (more details below)
          &lt;input type="hidden" name="_target_path" value="/account" /&gt;
      #}
  
      &lt;button type="submit"&gt;login&lt;/button&gt;
  &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>This is  UtilisateurRepository : </p>
  
  <pre><code>&lt;?php
  namespace App\Repository;
  use App\Entity\Utilisateur;
  use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
  use Symfony\Bridge\Doctrine\RegistryInterface;
  /**
  •   @method Utilisateur|null find($id, $lockMode = null, $lockVersion = null)
  •   @method Utilisateur|null findOneBy(array $criteria, array $orderBy = null)
  •   @method Utilisateur[] findAll()
  •   @method Utilisateur[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  */
  class UtilisateurRepository extends ServiceEntityRepository
  {
  public function __construct(RegistryInterface $registry)
  {
  parent::__construct($registry, Utilisateur::class);
  }
  // /**
  // * @return Utilisateur[] Returns an array of Utilisateur objects
  // /
  /
  public function findByExampleField($value)
  {
  return $this-&gt;createQueryBuilder('u')
  -&gt;andWhere('u.exampleField = :val')
  -&gt;setParameter('val', $value)
  -&gt;orderBy('u.id', 'ASC')
  -&gt;setMaxResults(10)
  -&gt;getQuery()
  -&gt;getResult()
  ;
  }
  */
  /*
  public function findOneBySomeField($value): ?Utilisateur
  {
  return $this-&gt;createQueryBuilder('u')
  -&gt;andWhere('u.exampleField = :val')
  -&gt;setParameter('val', $value)
  -&gt;getQuery()
  -&gt;getOneOrNullResult()
  ;
  }
  */
  }
  </code></pre>
  
  <p>Thank you for your help ! Don't hesitate if you need anything.</p>