|
| assembleParams ( $url, Zend_Oauth_Config_ConfigInterface $config, array $serviceProviderParams=null) |
|
| toEncodedQueryString (array $params, $customParamsOnly=false) |
|
| toAuthorizationHeader (array $params, $realm=null, $excludeCustomParams=true) |
|
| sign (array $params, $signatureMethod, $consumerSecret, $tokenSecret=null, $method=null, $url=null) |
|
| parseQueryString ($query) |
|
| generateNonce () |
|
| generateTimestamp () |
|
Definition at line 34 of file Utility.php.
◆ assembleParams()
Assemble all parameters for a generic OAuth request - i.e. no special params other than the defaults expected for any OAuth query.
- Parameters
-
- Returns
- array
Definition at line 45 of file Utility.php.
51 'oauth_consumer_key' =>
$config->getConsumerKey(),
58 if (
$config->getToken()->getToken() !=
null) {
63 if ($serviceProviderParams !==
null) {
71 $config->getToken()->getTokenSecret(),
sign(array $params, $signatureMethod, $consumerSecret, $tokenSecret=null, $method=null, $url=null)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ generateNonce()
Generate nonce
- Returns
- string
Definition at line 190 of file Utility.php.
192 return md5(uniqid(rand(),
true));
◆ generateTimestamp()
Generate timestamp
- Returns
- int
Definition at line 200 of file Utility.php.
◆ parseQueryString()
parseQueryString |
( |
|
$query | ) |
|
Parse query string
- Parameters
-
- Returns
- array
Definition at line 168 of file Utility.php.
177 $parts = explode(
'&',
$query);
178 foreach ($parts as $pair) {
179 $kv = explode(
'=', $pair);
180 $params[rawurldecode($kv[0])] = rawurldecode($kv[1]);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ sign()
sign |
( |
array |
$params, |
|
|
|
$signatureMethod, |
|
|
|
$consumerSecret, |
|
|
|
$tokenSecret = null , |
|
|
|
$method = null , |
|
|
|
$url = null |
|
) |
| |
Sign request
- Parameters
-
array | $params | |
string | $signatureMethod | |
string | $consumerSecret | |
null | string | $tokenSecret | |
null | string | $method | |
null | string | $url | |
- Returns
- string
Definition at line 144 of file Utility.php.
149 $parts = explode(
'-', $signatureMethod);
150 if (count($parts) > 1) {
151 $className =
'Zend_Oauth_Signature_' . ucfirst(strtolower($parts[0]));
152 $hashAlgo = $parts[1];
154 $className =
'Zend_Oauth_Signature_' . ucfirst(strtolower($signatureMethod));
157 #require_once str_replace('_', '/', $className) . '.php'; 158 $signatureObject =
new $className($consumerSecret, $tokenSecret, $hashAlgo);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ toAuthorizationHeader()
toAuthorizationHeader |
( |
array |
$params, |
|
|
|
$realm = null , |
|
|
|
$excludeCustomParams = true |
|
) |
| |
Cast to authorization header
- Parameters
-
array | $params | |
null | string | $realm | |
bool | $excludeCustomParams | |
- Returns
- void
Definition at line 114 of file Utility.php.
116 $headerValue = array(
117 'OAuth realm="' . $realm .
'"',
121 if ($excludeCustomParams) {
122 if (!preg_match(
"/^oauth_/", $key)) {
130 return implode(
",", $headerValue);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ toEncodedQueryString()
toEncodedQueryString |
( |
array |
$params, |
|
|
|
$customParamsOnly = false |
|
) |
| |
Given both OAuth parameters and any custom parametere, generate an encoded query string. This method expects parameters to have been assembled and signed beforehand.
- Parameters
-
array | $params | |
bool | $customParamsOnly | Ignores OAuth params e.g. for requests using OAuth Header |
- Returns
- string
Definition at line 88 of file Utility.php.
90 if ($customParamsOnly) {
92 if (preg_match(
"/^oauth_/", $key)) {
97 $encodedParams = array();
103 return implode(
'&', $encodedParams);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ urlEncode()
static urlEncode |
( |
|
$value | ) |
|
|
static |
urlencode a value
- Parameters
-
- Returns
- string
Definition at line 211 of file Utility.php.
213 $encoded = rawurlencode(
$value);
214 $encoded = str_replace(
'%7E',
'~', $encoded);
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Oauth/Http/Utility.php