public function createToken(UserInterface $user = null)
    {
        if(!$user) {
            $user = $this->getObject('user');
        }

        $token = $this->getObject('lib:http.token')
            ->setSubject($user->getId())
            ->sign($this->getSecret());

        return $token;
    }