|
| __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.
18 $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 113 of file Consumer.php.
References $url, SimpleSAML\Logger\debug(), SimpleSAML\Utils\HTTP\fetch(), and OAuthRequest\from_consumer_and_token().
116 $acc_req->sign_request($this->signer, $this->consumer, $requestToken);
121 throw new Exception(
'Error contacting request_token endpoint on the OAuth Provider');
126 parse_str($response_acc, $accessResponseParsed);
128 if (array_key_exists(
'error', $accessResponseParsed)) {
129 throw new Exception(
'Error getting request token: ' . $accessResponseParsed[
'error']);
132 $accessToken = $accessResponseParsed[
'oauth_token'];
133 $accessTokenSecret = $accessResponseParsed[
'oauth_token_secret'];
135 return new OAuthToken($accessToken, $accessTokenSecret);
OAuth PECL extension includes an OAuth Exception class, so we need to wrap the definition of this cla...
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
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 35 of file Consumer.php.
References $h.
37 foreach ($hrh as
$h) {
38 if (preg_match(
'|Content-Type:\s([^;]*)|i', $h, $matches)) {
◆ getHTTP()
static sspmod_oauth_Consumer::getHTTP |
( |
|
$url, |
|
|
|
$context = '' |
|
) |
| |
|
static |
Definition at line 54 of file Consumer.php.
References $context, $response, $url, and SimpleSAML\Utils\HTTP\fetch().
59 $statuscode =
'unknown';
60 if (preg_match(
'/^HTTP.*\s([0-9]{3})/', $http_response_header[0], $matches)) {
61 $statuscode = $matches[1];
64 $error =
$context .
' [statuscode: ' . $statuscode .
']: ';
65 $oautherror = self::getOAuthError($http_response_header);
67 if (!empty($oautherror)) {
68 $error .= $oautherror;
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
◆ getOAuthError()
static sspmod_oauth_Consumer::getOAuthError |
( |
|
$hrh | ) |
|
|
static |
Definition at line 25 of file Consumer.php.
References $h.
27 foreach ($hrh as
$h) {
28 if (preg_match(
'|OAuth-Error:\s([^;]*)|i', $h, $matches)) {
◆ getRequestToken()
sspmod_oauth_Consumer::getRequestToken |
( |
|
$url, |
|
|
|
$parameters = null |
|
) |
| |
Definition at line 77 of file Consumer.php.
References $url, and OAuthRequest\from_consumer_and_token().
80 $req_req->sign_request($this->signer, $this->consumer, null);
82 $response_req = self::getHTTP(
84 'Contacting request_token endpoint on the OAuth Provider' 87 parse_str($response_req, $responseParsed);
89 if (array_key_exists(
'error', $responseParsed)) {
90 throw new Exception(
'Error getting request token: ' . $responseParsed[
'error']);
93 $requestToken = $responseParsed[
'oauth_token'];
94 $requestTokenSecret = $responseParsed[
'oauth_token_secret'];
96 return new OAuthToken($requestToken, $requestTokenSecret);
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 165 of file Consumer.php.
References $data, $url, SimpleSAML\Utils\HTTP\fetch(), and OAuthRequest\from_consumer_and_token().
168 $data_req->sign_request($this->signer, $this->consumer, $accessToken);
172 return json_decode(
$data,
true);
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
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 138 of file Consumer.php.
References $response, $url, SimpleSAML\Utils\HTTP\fetch(), and OAuthRequest\from_consumer_and_token().
141 $data_req->sign_request($this->signer, $this->consumer, $accessToken);
142 $postdata = $data_req->to_postdata();
146 'verify_peer' =>
false,
147 'capture_peer_cert' =>
true,
148 'capture_peer_chain' =>
true 152 'content' => $postdata,
153 'header' =>
'Content-Type: application/x-www-form-urlencoded',
static fetch($url, $context=array(), $getHeaders=false)
Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorizati...
static from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=null)
pretty much a helper function to set up the request
◆ $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