7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
22 /** Zend_Oauth_Token */
23 require_once 'Zend/Oauth/Token.php';
25 /** Zend_Oauth_Http */
26 require_once 'Zend/Oauth/Http.php';
29 require_once 'Zend/Uri/Http.php';
31 /** Zend_Oauth_Client */
32 require_once 'Zend/Oauth/Client.php';
37 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
38 * @license http://framework.zend.com/license/new-bsd New BSD License
40 class Zend_Oauth_Token_Access extends Zend_Oauth_Token
46 * @param Zend_Oauth_Config_ConfigInterface $config
47 * @param null|array $customParams
48 * @param null|string $realm
51 public function toHeader(
52 $url, Zend_Oauth_Config_ConfigInterface $config, array $customParams = null, $realm = null
54 if (!Zend_Uri::check($url)) {
55 require_once 'Zend/Oauth/Exception.php';
56 throw new Zend_Oauth_Exception(
57 '\'' . $url . '\' is not a valid URI'
60 $params = $this->_httpUtility->assembleParams($url, $config, $customParams);
61 return $this->_httpUtility->toAuthorizationHeader($params, $realm);
65 * Cast to HTTP query string
68 * @param Zend_Oauth_Config_ConfigInterface $config
69 * @param null|array $params
72 public function toQueryString($url, Zend_Oauth_Config_ConfigInterface $config, array $params = null)
74 if (!Zend_Uri::check($url)) {
75 require_once 'Zend/Oauth/Exception.php';
76 throw new Zend_Oauth_Exception(
77 '\'' . $url . '\' is not a valid URI'
80 $params = $this->_httpUtility->assembleParams($url, $config, $params);
81 return $this->_httpUtility->toEncodedQueryString($params);
87 * @param array $oauthOptions
88 * @param null|string $uri
89 * @param null|array|Zend_Config $config
90 * @param bool $excludeCustomParamsFromHeader
91 * @return Zend_Oauth_Client
93 public function getHttpClient(array $oauthOptions, $uri = null, $config = null, $excludeCustomParamsFromHeader = true)
95 $client = new Zend_Oauth_Client($oauthOptions, $uri, $config, $excludeCustomParamsFromHeader);
96 $client->setToken($this);