Symfony\Component\Security\Authentication\Token\UsernamePasswordToken::setAuthenticated PHP Метод

setAuthenticated() публичный Метод

public setAuthenticated ( $isAuthenticated )
    public function setAuthenticated($isAuthenticated)
    {
        if ($isAuthenticated) {
            throw new \LogicException('Cannot set this token to trusted after instantiation.');
        }
        parent::setAuthenticated(false);
    }

Usage Example

Пример #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);
    }
All Usage Examples Of Symfony\Component\Security\Authentication\Token\UsernamePasswordToken::setAuthenticated