protected function acquireSecurityToken($username, $password)
    {
        $data = $this->prepareSecurityTokenRequest($username, $password, $this->authorityUrl);
        $response = Requests::post(self::$StsUrl,null,$data);

        try {
          $this->processSecurityTokenResponse($response);
        }
        catch (Exception $e) {
            // Try to get the token with a federated authentication.
            $response = $this->acquireSecurityTokenFromFederatedSTS($username, $password);

        }
        return $this->processSecurityTokenResponse($response);
    }