setAuthenticated() public method

public setAuthenticated ( $isAuthenticated )
Exemplo n.º 1
0
    /**
     * Authenticate a user with Symfony Security
     *
     * @param Boolean $reAuthenticate
     * @return null
     */
    protected function authenticateUser(User $user, $reAuthenticate = false)
    {
        $token = new UsernamePasswordToken($user, null, $user->getRoles());

        if (true === $reAuthenticate) {
            $token->setAuthenticated(false);
        }

        $this->get('security.context')->setToken($token);
    }
 public function testSetAuthenticatedToFalse()
 {
     $token = new UsernamePasswordToken('foo', 'bar');
     $token->setAuthenticated(false);
     $this->assertFalse($token->isAuthenticated());
 }