Skip to content

Commit

Permalink
Update custom_password_authenticator.rst
Browse files Browse the repository at this point in the history
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()```: 
```
...
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;
...
```
from base ```Controller```, it will fail, to get actually logged user and return null.
  • Loading branch information
Piotr Strugacz committed Jan 15, 2014
1 parent bede4c3 commit 18657aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cookbook/security/custom_password_authenticator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ the user::
}

return new UsernamePasswordToken(
$user->getUsername(),
$user,
$user->getPassword(),
$providerKey,
$user->getRoles()
Expand Down

0 comments on commit 18657aa

Please # to comment.