3require_once(dirname(dirname(__FILE__)) . 
'/libextinc/OAuth.php');
 
   17                $this->consumer = 
new OAuthConsumer(
$key, 
$secret, NULL);
 
   22        public static function dummy() {}
 
   27                        if (preg_match(
'|OAuth-Error:\s([^;]*)|i', 
$h, $matches)) {
 
   36                        if (preg_match(
'|Content-Type:\s([^;]*)|i', 
$h, $matches)) {
 
   56                        $statuscode = 
'unknown';
 
   57                        if (preg_match(
'/^HTTP.*\s([0-9]{3})/', $http_response_header[0], $matches)) $statuscode = $matches[1];
 
   59                        $error = $context . 
' [statuscode: ' . $statuscode . 
']: ';
 
   63                        if (!empty($oautherror)) 
$error .= $oautherror;
 
   73                $req_req->sign_request($this->signer, $this->consumer, NULL);
 
   76                        'Contacting request_token endpoint on the OAuth Provider');
 
   78                parse_str($response_req, $responseParsed);
 
   80                if(array_key_exists(
'error', $responseParsed))
 
   81                        throw new Exception(
'Error getting request token: ' . $responseParsed[
'error']);
 
   84                $requestTokenSecret = $responseParsed[
'oauth_token_secret'];
 
   92                        $params[
'oauth_callback'] = $callback;
 
   94                $authorizeURL = \SimpleSAML\Utils\HTTP::addURLParameters(
$url, 
$params);
 
  105                $acc_req->sign_request($this->signer, $this->consumer, 
$requestToken);
 
  107                $response_acc = file_get_contents($acc_req->to_url());
 
  108                if ($response_acc === FALSE) {
 
  109                        throw new Exception(
'Error contacting request_token endpoint on the OAuth Provider');
 
  114                parse_str($response_acc, $accessResponseParsed);
 
  116                if(array_key_exists(
'error', $accessResponseParsed))
 
  117                        throw new Exception(
'Error getting request token: ' . $accessResponseParsed[
'error']);
 
  120                $accessTokenSecret = $accessResponseParsed[
'oauth_token_secret'];
 
  127                $data_req->sign_request($this->signer, $this->consumer, 
$accessToken);
 
  128                $postdata = $data_req->to_postdata();
 
  132                                'verify_peer' => FALSE,
 
  133                                'capture_peer_cert' => TRUE,
 
  134                                'capture_peer_chain' => TRUE,
 
  138                                'content' => $postdata,
 
  139                                'header' => 
'Content-Type: application/x-www-form-urlencoded',
 
  142                $context = stream_context_create($opts);
 
  153                $data_req->sign_request($this->signer, $this->consumer, 
$accessToken);
 
  155                if (is_array($opts)) {
 
  156                        $opts = stream_context_create($opts);
 
  158                $data = file_get_contents($data_req->to_url(), FALSE, $opts);
 
  160                $dataDecoded = json_decode(
$data, TRUE);
 
An exception for terminatinating execution or to throw for unit testing.
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL)
pretty much a helper function to set up the request
The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] where t...
OAuth PECL extension includes an OAuth Exception class, so we need to wrap the definition of this cla...
static redirectTrustedURL($url, $parameters=array())
This function redirects to the specified URL without performing any security checks.
__construct($key, $secret)
getAuthorizeRequest($url, $requestToken, $redirect=TRUE, $callback=NULL)
getUserInfo($url, $accessToken, $opts=NULL)
getAccessToken($url, $requestToken, $parameters=NULL)
postRequest($url, $accessToken, $parameters)
getRequestToken($url, $parameters=NULL)
static getContentType($hrh)
static getHTTP($url, $context='')
static getOAuthError($hrh)