10 require_once
'EAuthServiceBase.php';
37 protected $scope =
'';
42 protected $providerOptions = array(
54 public function init($component, $options = array()) {
57 $this->auth =
new EOAuthUserIdentity(array(
58 'scope' => $this->scope,
60 'secret' => $this->secret,
61 'provider' => $this->providerOptions,
70 $this->authenticated = $this->auth->authenticate();
79 return $this->auth->getProvider()->consumer;
87 return $this->auth->getProvider()->token;
99 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Expect:'));
100 if (isset($options[
'data'])) {
101 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: text/xml",
"SOAPAction: \"/soap/action/query\"",
"Content-length: ".strlen($options[
'data'])));
116 throw new CHttpException(401, Yii::t(
'eauth',
'Unable to complete the request because the user was not authenticated.'));
119 $signatureMethod =
new OAuthSignatureMethod_HMAC_SHA1();
122 $request = OAuthRequest::from_consumer_and_token($consumer, $token, isset($options[
'data']) ?
'POST' :
'GET', $url);
123 $request->sign_request($signatureMethod, $consumer, $token);
124 $url = $request->to_url();
126 return $this->
makeRequest($url, $options, $parseJson);