When having a backend for admin users, it is interesting to have a login form, and at the same time having a normal login form for normal users in the public area of our website
Regarding to the approved answer, I made some adjustments in my Symfony 3.2.8 project in order to work correctly.
Instead of
$requestAttributes = $this->container->get('request')->attributes;
in the Security Controller, I used $requestAttributes = $this->container->get('request_stack')->getCurrentRequest();.