I\'m trying to use the new LdapUserProvider in Symfony 2.8. I believe I have configured everything per the docs.
My user can successfully authenticate, and then gets red
I had almost exactly the same problem. After intense debugging, I came to the line:
in \Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken::__construct
:
parent::setAuthenticated(count($roles) > 0);
This was a problem, because I diagnosed, that UsernamePasswordToken was coming unauthenticated from session storage to begin with. This was caused by no roles assigned due to my custom overriding of default services.
Normally, LDAP will be called only once on login and no password should be stored in session. Only authenticated = true
in serialized token.
Are you sure you are getting unserialised authenticated token?