|
| __construct ($key, $secret) |
|
| getRequestToken ($url, $parameters=NULL) |
|
| getAuthorizeRequest ($url, $requestToken, $redirect=TRUE, $callback=NULL) |
|
| getAccessToken ($url, $requestToken, $parameters=NULL) |
|
| postRequest ($url, $accessToken, $parameters) |
|
| getUserInfo ($url, $accessToken, $opts=NULL) |
|
Definition at line 11 of file Consumer.php.
◆ __construct()
sspmod_oauth_Consumer::__construct |
( |
|
$key, |
|
|
|
$secret |
|
) |
| |
Definition at line 16 of file Consumer.php.
References $key, and $secret.
17 $this->consumer =
new OAuthConsumer(
$key,
$secret, NULL);
The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104] where t...
◆ dummy()
static sspmod_oauth_Consumer::dummy |
( |
| ) |
|
|
static |
◆ getAccessToken()
sspmod_oauth_Consumer::getAccessToken |
( |
|
$url, |
|
|
|
$requestToken, |
|
|
|
$parameters = NULL |
|
) |
| |
Definition at line 102 of file Consumer.php.
References $accessToken, $requestToken, $url, SimpleSAML\Logger\debug(), and OAuthRequest\from_consumer_and_token().
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'];
OAuth PECL extension includes an OAuth Exception class, so we need to wrap the definition of this cla...
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL)
pretty much a helper function to set up the request
◆ getAuthorizeRequest()
sspmod_oauth_Consumer::getAuthorizeRequest |
( |
|
$url, |
|
|
|
$requestToken, |
|
|
|
$redirect = TRUE , |
|
|
|
$callback = NULL |
|
) |
| |
◆ getContentType()
static sspmod_oauth_Consumer::getContentType |
( |
|
$hrh | ) |
|
|
static |
Definition at line 34 of file Consumer.php.
References $h.
36 if (preg_match(
'|Content-Type:\s([^;]*)|i', $h, $matches)) {
◆ getHTTP()
static sspmod_oauth_Consumer::getHTTP |
( |
|
$url, |
|
|
|
$context = '' |
|
) |
| |
|
static |
Definition at line 52 of file Consumer.php.
References $error, $response, and $url.
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 .
']: ';
60 $contenttype = self::getContentType($http_response_header);
61 $oautherror = self::getOAuthError($http_response_header);
63 if (!empty($oautherror))
$error .= $oautherror;
◆ getOAuthError()
static sspmod_oauth_Consumer::getOAuthError |
( |
|
$hrh | ) |
|
|
static |
Definition at line 25 of file Consumer.php.
References $h.
27 if (preg_match(
'|OAuth-Error:\s([^;]*)|i', $h, $matches)) {
◆ getRequestToken()
sspmod_oauth_Consumer::getRequestToken |
( |
|
$url, |
|
|
|
$parameters = NULL |
|
) |
| |
Definition at line 71 of file Consumer.php.
References $requestToken, $url, and OAuthRequest\from_consumer_and_token().
73 $req_req->sign_request($this->signer, $this->consumer, NULL);
75 $response_req = self::getHTTP($req_req->to_url(),
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'];
OAuth PECL extension includes an OAuth Exception class, so we need to wrap the definition of this cla...
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL)
pretty much a helper function to set up the request
◆ getUserInfo()
sspmod_oauth_Consumer::getUserInfo |
( |
|
$url, |
|
|
|
$accessToken, |
|
|
|
$opts = NULL |
|
) |
| |
Definition at line 150 of file Consumer.php.
References $accessToken, $data, $url, and OAuthRequest\from_consumer_and_token().
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);
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL)
pretty much a helper function to set up the request
◆ postRequest()
sspmod_oauth_Consumer::postRequest |
( |
|
$url, |
|
|
|
$accessToken, |
|
|
|
$parameters |
|
) |
| |
Definition at line 125 of file Consumer.php.
References $accessToken, $response, $url, array, and OAuthRequest\from_consumer_and_token().
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);
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL)
pretty much a helper function to set up the request
Create styles array
The data for the language used.
◆ $consumer
sspmod_oauth_Consumer::$consumer |
|
private |
◆ $signer
sspmod_oauth_Consumer::$signer |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/oauth/lib/Consumer.php