Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Oauth_Config Class Reference
Inheritance diagram for Zend_Oauth_Config:
Zend_Oauth_Config_ConfigInterface

Public Member Functions

 __construct ($options=null)
 
 setOptions (array $options)
 
 setConsumerKey ($key)
 
 getConsumerKey ()
 
 setConsumerSecret ($secret)
 
 getConsumerSecret ()
 
 setSignatureMethod ($method)
 
 getSignatureMethod ()
 
 setRequestScheme ($scheme)
 
 getRequestScheme ()
 
 setVersion ($version)
 
 getVersion ()
 
 setCallbackUrl ($url)
 
 getCallbackUrl ()
 
 setSiteUrl ($url)
 
 getSiteUrl ()
 
 setRequestTokenUrl ($url)
 
 getRequestTokenUrl ()
 
 setAccessTokenUrl ($url)
 
 getAccessTokenUrl ()
 
 setUserAuthorizationUrl ($url)
 
 setAuthorizeUrl ($url)
 
 getUserAuthorizationUrl ()
 
 getAuthorizeUrl ()
 
 setRequestMethod ($method)
 
 getRequestMethod ()
 
 setRsaPublicKey (Zend_Crypt_Rsa_Key_Public $key)
 
 getRsaPublicKey ()
 
 setRsaPrivateKey (Zend_Crypt_Rsa_Key_Private $key)
 
 getRsaPrivateKey ()
 
 setToken (Zend_Oauth_Token $token)
 
 getToken ()
 
 setRealm ($realm)
 
 getRealm ()
 

Protected Attributes

 $_signatureMethod = 'HMAC-SHA1'
 
 $_requestScheme = Zend_Oauth::REQUEST_SCHEME_HEADER
 
 $_requestMethod = Zend_Oauth::POST
 
 $_version = '1.0'
 
 $_callbackUrl = null
 
 $_siteUrl = null
 
 $_requestTokenUrl = null
 
 $_accessTokenUrl = null
 
 $_authorizeUrl = null
 
 $_consumerKey = null
 
 $_consumerSecret = null
 
 $_rsaPrivateKey = null
 
 $_rsaPublicKey = null
 
 $_token = null
 
 $_realm = null
 

Detailed Description

Definition at line 37 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $options = null)

Constructor; create a new object with an optional array|Zend_Config instance containing initialising options.

Parameters
array | Zend_Config$options
Returns
void

Definition at line 164 of file Config.php.

165  {
166  if ($options !== null) {
167  if ($options instanceof Zend_Config) {
168  $options = $options->toArray();
169  }
170  $this->setOptions($options);
171  }
172  }
setOptions(array $options)
Definition: Config.php:181

Member Function Documentation

◆ getAccessTokenUrl()

getAccessTokenUrl ( )

Get access token URL

If no access token URL has been set, but a site URL has, returns the site URL with the string "/access_token" appended.

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 504 of file Config.php.

505  {
506  if (!$this->_accessTokenUrl && $this->_siteUrl) {
507  return $this->_siteUrl . '/access_token';
508  }
509  return $this->_accessTokenUrl;
510  }

◆ getAuthorizeUrl()

getAuthorizeUrl ( )

Get authorization URL

If no authorization URL has been set, but a site URL has, returns the site URL with the string "/authorize" appended.

Returns
string

Definition at line 561 of file Config.php.

562  {
563  if (!$this->_authorizeUrl && $this->_siteUrl) {
564  return $this->_siteUrl . '/authorize';
565  }
566  return $this->_authorizeUrl;
567  }

◆ getCallbackUrl()

getCallbackUrl ( )

Get callback URL

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 408 of file Config.php.

409  {
410  return $this->_callbackUrl;
411  }

◆ getConsumerKey()

getConsumerKey ( )

Get consumer key

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 253 of file Config.php.

254  {
255  return $this->_consumerKey;
256  }

◆ getConsumerSecret()

getConsumerSecret ( )

Get consumer secret

Returns RSA private key if set; otherwise, returns any previously set consumer secret.

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 278 of file Config.php.

279  {
280  if ($this->_rsaPrivateKey !== null) {
281  return $this->_rsaPrivateKey;
282  }
283  return $this->_consumerSecret;
284  }

◆ getRealm()

getRealm ( )

Get OAuth realm

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 687 of file Config.php.

688  {
689  return $this->_realm;
690  }

◆ getRequestMethod()

getRequestMethod ( )

Get request method

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 599 of file Config.php.

600  {
601  return $this->_requestMethod;
602  }

◆ getRequestScheme()

getRequestScheme ( )

Get request scheme

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 357 of file Config.php.

358  {
359  return $this->_requestScheme;
360  }

◆ getRequestTokenUrl()

getRequestTokenUrl ( )

Get request token URL

If no request token URL has been set, but a site URL has, returns the site URL with the string "/request_token" appended.

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 469 of file Config.php.

470  {
471  if (!$this->_requestTokenUrl && $this->_siteUrl) {
472  return $this->_siteUrl . '/request_token';
473  }
475  }

◆ getRsaPrivateKey()

getRsaPrivateKey ( )

Get RSA private key

Returns
Zend_Crypt_Rsa_Key_Private

Definition at line 643 of file Config.php.

644  {
645  return $this->_rsaPrivateKey;
646  }

◆ getRsaPublicKey()

getRsaPublicKey ( )

Get RSA public key

Returns
Zend_Crypt_Rsa_Key_Public

Definition at line 621 of file Config.php.

622  {
623  return $this->_rsaPublicKey;
624  }

◆ getSignatureMethod()

getSignatureMethod ( )

Get signature method

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 314 of file Config.php.

315  {
317  }

◆ getSiteUrl()

getSiteUrl ( )

Get site URL

Returns
string

Definition at line 437 of file Config.php.

438  {
439  return $this->_siteUrl;
440  }

◆ getToken()

getToken ( )

Get OAuth token

Returns
Zend_Oauth_Token

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 665 of file Config.php.

666  {
667  return $this->_token;
668  }

◆ getUserAuthorizationUrl()

getUserAuthorizationUrl ( )

Get user authorization URL

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 548 of file Config.php.

549  {
550  return $this->getAuthorizeUrl();
551  }

◆ getVersion()

getVersion ( )

Get version

Returns
string

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 379 of file Config.php.

380  {
381  return $this->_version;
382  }

◆ setAccessTokenUrl()

setAccessTokenUrl (   $url)

Set access token URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 484 of file Config.php.

485  {
486  if (!Zend_Uri::check($url)) {
487  #require_once 'Zend/Oauth/Exception.php';
488  throw new Zend_Oauth_Exception(
489  '\'' . $url . '\' is not a valid URI'
490  );
491  }
492  $this->_accessTokenUrl = rtrim($url, '/');
493  return $this;
494  }
static check($uri)
Definition: Uri.php:72

◆ setAuthorizeUrl()

setAuthorizeUrl (   $url)

Set authorization URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Definition at line 531 of file Config.php.

532  {
533  if (!Zend_Uri::check($url)) {
534  #require_once 'Zend/Oauth/Exception.php';
535  throw new Zend_Oauth_Exception(
536  '\'' . $url . '\' is not a valid URI'
537  );
538  }
539  $this->_authorizeUrl = rtrim($url, '/');
540  return $this;
541  }
static check($uri)
Definition: Uri.php:72

◆ setCallbackUrl()

setCallbackUrl (   $url)

Set callback URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 391 of file Config.php.

392  {
393  if (!Zend_Uri::check($url) && $url !== 'oob') {
394  #require_once 'Zend/Oauth/Exception.php';
395  throw new Zend_Oauth_Exception(
396  '\'' . $url . '\' is not a valid URI'
397  );
398  }
399  $this->_callbackUrl = $url;
400  return $this;
401  }
static check($uri)
Definition: Uri.php:72

◆ setConsumerKey()

setConsumerKey (   $key)

Set consumer key

Parameters
string$key
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 242 of file Config.php.

243  {
244  $this->_consumerKey = $key;
245  return $this;
246  }

◆ setConsumerSecret()

setConsumerSecret (   $secret)

Set consumer secret

Parameters
string$secret
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 264 of file Config.php.

265  {
266  $this->_consumerSecret = $secret;
267  return $this;
268  }

◆ setOptions()

setOptions ( array  $options)

Parse option array or Zend_Config instance and setup options using their relevant mutators.

Parameters
array | Zend_Config$options
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 181 of file Config.php.

182  {
183  foreach ($options as $key => $value) {
184  switch ($key) {
185  case 'consumerKey':
186  $this->setConsumerKey($value);
187  break;
188  case 'consumerSecret':
189  $this->setConsumerSecret($value);
190  break;
191  case 'signatureMethod':
192  $this->setSignatureMethod($value);
193  break;
194  case 'version':
195  $this->setVersion($value);
196  break;
197  case 'callbackUrl':
198  $this->setCallbackUrl($value);
199  break;
200  case 'siteUrl':
201  $this->setSiteUrl($value);
202  break;
203  case 'requestTokenUrl':
204  $this->setRequestTokenUrl($value);
205  break;
206  case 'accessTokenUrl':
207  $this->setAccessTokenUrl($value);
208  break;
209  case 'userAuthorizationUrl':
211  break;
212  case 'authorizeUrl':
213  $this->setAuthorizeUrl($value);
214  break;
215  case 'requestMethod':
216  $this->setRequestMethod($value);
217  break;
218  case 'rsaPrivateKey':
219  $this->setRsaPrivateKey($value);
220  break;
221  case 'rsaPublicKey':
222  $this->setRsaPublicKey($value);
223  break;
224  case 'realm':
225  $this->setRealm($value);
226  break;
227  }
228  }
229  if (isset($options['requestScheme'])) {
230  $this->setRequestScheme($options['requestScheme']);
231  }
232 
233  return $this;
234  }
setSignatureMethod($method)
Definition: Config.php:293
setConsumerKey($key)
Definition: Config.php:242
setVersion($version)
Definition: Config.php:368
setRequestMethod($method)
Definition: Config.php:576
setUserAuthorizationUrl($url)
Definition: Config.php:519
setConsumerSecret($secret)
Definition: Config.php:264
setAccessTokenUrl($url)
Definition: Config.php:484
$value
Definition: gender.phtml:16
setRequestScheme($scheme)
Definition: Config.php:326
setSiteUrl($url)
Definition: Config.php:420
setRequestTokenUrl($url)
Definition: Config.php:449
setRsaPrivateKey(Zend_Crypt_Rsa_Key_Private $key)
Definition: Config.php:632
setCallbackUrl($url)
Definition: Config.php:391
setAuthorizeUrl($url)
Definition: Config.php:531
setRealm($realm)
Definition: Config.php:676
setRsaPublicKey(Zend_Crypt_Rsa_Key_Public $key)
Definition: Config.php:610

◆ setRealm()

setRealm (   $realm)

Set OAuth realm

Parameters
string$realm
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 676 of file Config.php.

677  {
678  $this->_realm = $realm;
679  return $this;
680  }

◆ setRequestMethod()

setRequestMethod (   $method)

Set request method

Parameters
string$method
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid request methods

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 576 of file Config.php.

577  {
578  $method = strtoupper($method);
579  if (!in_array($method, array(
585  ))
586  ) {
587  #require_once 'Zend/Oauth/Exception.php';
588  throw new Zend_Oauth_Exception('Invalid method: ' . $method);
589  }
590  $this->_requestMethod = $method;
591  return $this;
592  }
const POST
Definition: Oauth.php:37
const DELETE
Definition: Oauth.php:39
const PUT
Definition: Oauth.php:38
$method
Definition: info.phtml:13
const GET
Definition: Oauth.php:36
const OPTIONS
Definition: Oauth.php:41

◆ setRequestScheme()

setRequestScheme (   $scheme)

Set request scheme

Parameters
string$scheme
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionif invalid scheme specified, or if POSTBODY set when request method of GET is specified

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 326 of file Config.php.

327  {
328  $scheme = strtolower($scheme);
329  if (!in_array($scheme, array(
333  ))
334  ) {
335  #require_once 'Zend/Oauth/Exception.php';
336  throw new Zend_Oauth_Exception(
337  '\'' . $scheme . '\' is an unsupported request scheme'
338  );
339  }
340  if ($scheme == Zend_Oauth::REQUEST_SCHEME_POSTBODY
341  && $this->getRequestMethod() == Zend_Oauth::GET
342  ) {
343  #require_once 'Zend/Oauth/Exception.php';
344  throw new Zend_Oauth_Exception(
345  'Cannot set POSTBODY request method if HTTP method set to GET'
346  );
347  }
348  $this->_requestScheme = $scheme;
349  return $this;
350  }
const REQUEST_SCHEME_HEADER
Definition: Oauth.php:33
const REQUEST_SCHEME_QUERYSTRING
Definition: Oauth.php:35
const REQUEST_SCHEME_POSTBODY
Definition: Oauth.php:34

◆ setRequestTokenUrl()

setRequestTokenUrl (   $url)

Set request token URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 449 of file Config.php.

450  {
451  if (!Zend_Uri::check($url)) {
452  #require_once 'Zend/Oauth/Exception.php';
453  throw new Zend_Oauth_Exception(
454  '\'' . $url . '\' is not a valid URI'
455  );
456  }
457  $this->_requestTokenUrl = rtrim($url, '/');
458  return $this;
459  }
static check($uri)
Definition: Uri.php:72

◆ setRsaPrivateKey()

setRsaPrivateKey ( Zend_Crypt_Rsa_Key_Private  $key)

Set RSA private key

Parameters
Zend_Crypt_Rsa_Key_Private$key
Returns
Zend_Oauth_Config

Definition at line 632 of file Config.php.

633  {
634  $this->_rsaPrivateKey = $key;
635  return $this;
636  }

◆ setRsaPublicKey()

setRsaPublicKey ( Zend_Crypt_Rsa_Key_Public  $key)

Set RSA public key

Parameters
Zend_Crypt_Rsa_Key_Public$key
Returns
Zend_Oauth_Config

Definition at line 610 of file Config.php.

611  {
612  $this->_rsaPublicKey = $key;
613  return $this;
614  }

◆ setSignatureMethod()

setSignatureMethod (   $method)

Set signature method

Parameters
string$method
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionif unsupported signature method specified

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 293 of file Config.php.

294  {
295  $method = strtoupper($method);
296  if (!in_array($method, array(
297  'HMAC-SHA1', 'HMAC-SHA256', 'RSA-SHA1', 'PLAINTEXT'
298  ))
299  ) {
300  #require_once 'Zend/Oauth/Exception.php';
301  throw new Zend_Oauth_Exception('Unsupported signature method: '
302  . $method
303  . '. Supported are HMAC-SHA1, RSA-SHA1, PLAINTEXT and HMAC-SHA256');
304  }
305  $this->_signatureMethod = $method;;
306  return $this;
307  }
$method
Definition: info.phtml:13

◆ setSiteUrl()

setSiteUrl (   $url)

Set site URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Definition at line 420 of file Config.php.

421  {
422  if (!Zend_Uri::check($url)) {
423  #require_once 'Zend/Oauth/Exception.php';
424  throw new Zend_Oauth_Exception(
425  '\'' . $url . '\' is not a valid URI'
426  );
427  }
428  $this->_siteUrl = $url;
429  return $this;
430  }
static check($uri)
Definition: Uri.php:72

◆ setToken()

setToken ( Zend_Oauth_Token  $token)

Set OAuth token

Parameters
Zend_Oauth_Token$token
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 654 of file Config.php.

655  {
656  $this->_token = $token;
657  return $this;
658  }

◆ setUserAuthorizationUrl()

setUserAuthorizationUrl (   $url)

Set user authorization URL

Parameters
string$url
Returns
Zend_Oauth_Config
Exceptions
Zend_Oauth_Exceptionfor invalid URLs

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 519 of file Config.php.

520  {
521  return $this->setAuthorizeUrl($url);
522  }
setAuthorizeUrl($url)
Definition: Config.php:531

◆ setVersion()

setVersion (   $version)

Set version

Parameters
string$version
Returns
Zend_Oauth_Config

Implements Zend_Oauth_Config_ConfigInterface.

Definition at line 368 of file Config.php.

369  {
370  $this->_version = $version;
371  return $this;
372  }

Field Documentation

◆ $_accessTokenUrl

$_accessTokenUrl = null
protected

Definition at line 102 of file Config.php.

◆ $_authorizeUrl

$_authorizeUrl = null
protected

Definition at line 110 of file Config.php.

◆ $_callbackUrl

$_callbackUrl = null
protected

Definition at line 79 of file Config.php.

◆ $_consumerKey

$_consumerKey = null
protected

Definition at line 117 of file Config.php.

◆ $_consumerSecret

$_consumerSecret = null
protected

Definition at line 124 of file Config.php.

◆ $_realm

$_realm = null
protected

Definition at line 155 of file Config.php.

◆ $_requestMethod

$_requestMethod = Zend_Oauth::POST
protected

Definition at line 62 of file Config.php.

◆ $_requestScheme

$_requestScheme = Zend_Oauth::REQUEST_SCHEME_HEADER
protected

Definition at line 53 of file Config.php.

◆ $_requestTokenUrl

$_requestTokenUrl = null
protected

Definition at line 94 of file Config.php.

◆ $_rsaPrivateKey

$_rsaPrivateKey = null
protected

Definition at line 132 of file Config.php.

◆ $_rsaPublicKey

$_rsaPublicKey = null
protected

Definition at line 140 of file Config.php.

◆ $_signatureMethod

$_signatureMethod = 'HMAC-SHA1'
protected

Definition at line 44 of file Config.php.

◆ $_siteUrl

$_siteUrl = null
protected

Definition at line 86 of file Config.php.

◆ $_token

$_token = null
protected

Definition at line 148 of file Config.php.

◆ $_version

$_version = '1.0'
protected

Definition at line 69 of file Config.php.


The documentation for this class was generated from the following file: