protected function saveToken()
    {
        if (isset($this->token) && $this->token) {
            return;
        }

        if ($this->token = $this->getCookie($this->getCookieName())) {
            return;
        }

        // If cookie token doesn't exist, we need to create it with unique token...
        $this->token = base_convert(md5(uniqid(rand(), true)), 16, 36);
        setcookie($this->getCookieName(), $this->token, time() + 60 * 60 * 12, '/');

        // ... and attach it to broker session in SSO server.
        $this->attach();
    }