symfony/symfony-docs — pull request #3478 by piotras-s (2014-01-15 15:50:47+00:00)
Title: Update custom_password_authenticator.rst

Correct me if I am wrong... but because we are passing here ```username``` as first argument to ```UsernamePasswordToken```, when one would like to use method ```getUser()``` from base ```Controller```:
```
...
if (!$this->container->has('security.context')) {
throw new \LogicException('The SecurityBundle is not registered in your application.');
}

if (null === $token = $this->container->get('security.context')->getToken()) {
return null;
}

if (!is_object($user = $token->getUser())) {
return null;
}

return $user;
...
```
it will fail to get actually logged in user and return null.