From 135b921db75da5995eab7e36393ecd4d2b0bc66f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 4 Nov 2014 21:33:05 -0500 Subject: Switch to composer --- vendor/OAuth/Common/AutoLoader.php | 81 ---- vendor/OAuth/Common/Consumer/Credentials.php | 60 --- .../OAuth/Common/Consumer/CredentialsInterface.php | 24 -- vendor/OAuth/Common/Exception/Exception.php | 10 - vendor/OAuth/Common/Http/Client/AbstractClient.php | 73 ---- .../OAuth/Common/Http/Client/ClientInterface.php | 32 -- vendor/OAuth/Common/Http/Client/CurlClient.php | 142 ------- vendor/OAuth/Common/Http/Client/StreamClient.php | 92 ----- .../Http/Exception/TokenResponseException.php | 12 - vendor/OAuth/Common/Http/Uri/Uri.php | 408 --------------------- vendor/OAuth/Common/Http/Uri/UriFactory.php | 168 --------- .../OAuth/Common/Http/Uri/UriFactoryInterface.php | 42 --- vendor/OAuth/Common/Http/Uri/UriInterface.php | 133 ------- vendor/OAuth/Common/Service/AbstractService.php | 100 ----- vendor/OAuth/Common/Service/ServiceInterface.php | 49 --- .../AuthorizationStateNotFoundException.php | 10 - .../Common/Storage/Exception/StorageException.php | 12 - .../Storage/Exception/TokenNotFoundException.php | 10 - vendor/OAuth/Common/Storage/Memory.php | 139 ------- vendor/OAuth/Common/Storage/Redis.php | 230 ------------ vendor/OAuth/Common/Storage/Session.php | 188 ---------- vendor/OAuth/Common/Storage/SymfonySession.php | 200 ---------- .../OAuth/Common/Storage/TokenStorageInterface.php | 98 ----- vendor/OAuth/Common/Token/AbstractToken.php | 128 ------- .../Token/Exception/ExpiredTokenException.php | 12 - vendor/OAuth/Common/Token/TokenInterface.php | 64 ---- vendor/OAuth/OAuth1/Service/AbstractService.php | 305 --------------- vendor/OAuth/OAuth1/Service/BitBucket.php | 96 ----- vendor/OAuth/OAuth1/Service/Etsy.php | 132 ------- vendor/OAuth/OAuth1/Service/FitBit.php | 96 ----- vendor/OAuth/OAuth1/Service/Flickr.php | 91 ----- vendor/OAuth/OAuth1/Service/ScoopIt.php | 96 ----- vendor/OAuth/OAuth1/Service/ServiceInterface.php | 45 --- vendor/OAuth/OAuth1/Service/Tumblr.php | 96 ----- vendor/OAuth/OAuth1/Service/Twitter.php | 121 ------ vendor/OAuth/OAuth1/Service/Xing.php | 96 ----- vendor/OAuth/OAuth1/Service/Yahoo.php | 96 ----- .../UnsupportedHashAlgorithmException.php | 12 - vendor/OAuth/OAuth1/Signature/Signature.php | 132 ------- .../OAuth/OAuth1/Signature/SignatureInterface.php | 28 -- vendor/OAuth/OAuth1/Token/StdOAuth1Token.php | 75 ---- vendor/OAuth/OAuth1/Token/TokenInterface.php | 41 --- vendor/OAuth/OAuth2/Service/AbstractService.php | 333 ----------------- vendor/OAuth/OAuth2/Service/Amazon.php | 97 ----- vendor/OAuth/OAuth2/Service/Bitly.php | 111 ------ vendor/OAuth/OAuth2/Service/Box.php | 88 ----- vendor/OAuth/OAuth2/Service/Buffer.php | 151 -------- vendor/OAuth/OAuth2/Service/Dailymotion.php | 129 ------- vendor/OAuth/OAuth2/Service/Dropbox.php | 111 ------ .../Exception/InvalidAccessTypeException.php | 12 - .../InvalidAuthorizationStateException.php | 10 - .../Service/Exception/InvalidScopeException.php | 17 - .../Exception/MissingRefreshTokenException.php | 17 - vendor/OAuth/OAuth2/Service/Facebook.php | 193 ---------- vendor/OAuth/OAuth2/Service/Foursquare.php | 81 ---- vendor/OAuth/OAuth2/Service/GitHub.php | 208 ----------- vendor/OAuth/OAuth2/Service/Google.php | 158 -------- vendor/OAuth/OAuth2/Service/Harvest.php | 157 -------- vendor/OAuth/OAuth2/Service/Heroku.php | 123 ------- vendor/OAuth/OAuth2/Service/Instagram.php | 85 ----- vendor/OAuth/OAuth2/Service/Linkedin.php | 102 ------ vendor/OAuth/OAuth2/Service/Mailchimp.php | 115 ------ vendor/OAuth/OAuth2/Service/Microsoft.php | 119 ------ vendor/OAuth/OAuth2/Service/Paypal.php | 103 ------ vendor/OAuth/OAuth2/Service/Pocket.php | 125 ------- vendor/OAuth/OAuth2/Service/Reddit.php | 114 ------ vendor/OAuth/OAuth2/Service/RunKeeper.php | 105 ------ vendor/OAuth/OAuth2/Service/Salesforce.php | 92 ----- vendor/OAuth/OAuth2/Service/ServiceInterface.php | 37 -- vendor/OAuth/OAuth2/Service/SoundCloud.php | 77 ---- vendor/OAuth/OAuth2/Service/Ustream.php | 98 ----- vendor/OAuth/OAuth2/Service/Vkontakte.php | 109 ------ vendor/OAuth/OAuth2/Service/Yammer.php | 82 ----- vendor/OAuth/OAuth2/Token/StdOAuth2Token.php | 13 - vendor/OAuth/OAuth2/Token/TokenInterface.php | 9 - vendor/OAuth/ServiceFactory.php | 229 ------------ vendor/OAuth/bootstrap.php | 13 - 77 files changed, 7698 deletions(-) delete mode 100755 vendor/OAuth/Common/AutoLoader.php delete mode 100755 vendor/OAuth/Common/Consumer/Credentials.php delete mode 100755 vendor/OAuth/Common/Consumer/CredentialsInterface.php delete mode 100755 vendor/OAuth/Common/Exception/Exception.php delete mode 100755 vendor/OAuth/Common/Http/Client/AbstractClient.php delete mode 100755 vendor/OAuth/Common/Http/Client/ClientInterface.php delete mode 100755 vendor/OAuth/Common/Http/Client/CurlClient.php delete mode 100755 vendor/OAuth/Common/Http/Client/StreamClient.php delete mode 100755 vendor/OAuth/Common/Http/Exception/TokenResponseException.php delete mode 100755 vendor/OAuth/Common/Http/Uri/Uri.php delete mode 100755 vendor/OAuth/Common/Http/Uri/UriFactory.php delete mode 100755 vendor/OAuth/Common/Http/Uri/UriFactoryInterface.php delete mode 100755 vendor/OAuth/Common/Http/Uri/UriInterface.php delete mode 100755 vendor/OAuth/Common/Service/AbstractService.php delete mode 100755 vendor/OAuth/Common/Service/ServiceInterface.php delete mode 100755 vendor/OAuth/Common/Storage/Exception/AuthorizationStateNotFoundException.php delete mode 100755 vendor/OAuth/Common/Storage/Exception/StorageException.php delete mode 100755 vendor/OAuth/Common/Storage/Exception/TokenNotFoundException.php delete mode 100755 vendor/OAuth/Common/Storage/Memory.php delete mode 100755 vendor/OAuth/Common/Storage/Redis.php delete mode 100755 vendor/OAuth/Common/Storage/Session.php delete mode 100755 vendor/OAuth/Common/Storage/SymfonySession.php delete mode 100755 vendor/OAuth/Common/Storage/TokenStorageInterface.php delete mode 100755 vendor/OAuth/Common/Token/AbstractToken.php delete mode 100755 vendor/OAuth/Common/Token/Exception/ExpiredTokenException.php delete mode 100755 vendor/OAuth/Common/Token/TokenInterface.php delete mode 100755 vendor/OAuth/OAuth1/Service/AbstractService.php delete mode 100755 vendor/OAuth/OAuth1/Service/BitBucket.php delete mode 100755 vendor/OAuth/OAuth1/Service/Etsy.php delete mode 100755 vendor/OAuth/OAuth1/Service/FitBit.php delete mode 100755 vendor/OAuth/OAuth1/Service/Flickr.php delete mode 100755 vendor/OAuth/OAuth1/Service/ScoopIt.php delete mode 100755 vendor/OAuth/OAuth1/Service/ServiceInterface.php delete mode 100755 vendor/OAuth/OAuth1/Service/Tumblr.php delete mode 100755 vendor/OAuth/OAuth1/Service/Twitter.php delete mode 100755 vendor/OAuth/OAuth1/Service/Xing.php delete mode 100755 vendor/OAuth/OAuth1/Service/Yahoo.php delete mode 100755 vendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php delete mode 100755 vendor/OAuth/OAuth1/Signature/Signature.php delete mode 100755 vendor/OAuth/OAuth1/Signature/SignatureInterface.php delete mode 100755 vendor/OAuth/OAuth1/Token/StdOAuth1Token.php delete mode 100755 vendor/OAuth/OAuth1/Token/TokenInterface.php delete mode 100755 vendor/OAuth/OAuth2/Service/AbstractService.php delete mode 100755 vendor/OAuth/OAuth2/Service/Amazon.php delete mode 100755 vendor/OAuth/OAuth2/Service/Bitly.php delete mode 100755 vendor/OAuth/OAuth2/Service/Box.php delete mode 100644 vendor/OAuth/OAuth2/Service/Buffer.php delete mode 100755 vendor/OAuth/OAuth2/Service/Dailymotion.php delete mode 100755 vendor/OAuth/OAuth2/Service/Dropbox.php delete mode 100755 vendor/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php delete mode 100755 vendor/OAuth/OAuth2/Service/Exception/InvalidAuthorizationStateException.php delete mode 100755 vendor/OAuth/OAuth2/Service/Exception/InvalidScopeException.php delete mode 100755 vendor/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php delete mode 100755 vendor/OAuth/OAuth2/Service/Facebook.php delete mode 100755 vendor/OAuth/OAuth2/Service/Foursquare.php delete mode 100755 vendor/OAuth/OAuth2/Service/GitHub.php delete mode 100755 vendor/OAuth/OAuth2/Service/Google.php delete mode 100755 vendor/OAuth/OAuth2/Service/Harvest.php delete mode 100755 vendor/OAuth/OAuth2/Service/Heroku.php delete mode 100755 vendor/OAuth/OAuth2/Service/Instagram.php delete mode 100755 vendor/OAuth/OAuth2/Service/Linkedin.php delete mode 100755 vendor/OAuth/OAuth2/Service/Mailchimp.php delete mode 100755 vendor/OAuth/OAuth2/Service/Microsoft.php delete mode 100755 vendor/OAuth/OAuth2/Service/Paypal.php delete mode 100755 vendor/OAuth/OAuth2/Service/Pocket.php delete mode 100755 vendor/OAuth/OAuth2/Service/Reddit.php delete mode 100755 vendor/OAuth/OAuth2/Service/RunKeeper.php delete mode 100755 vendor/OAuth/OAuth2/Service/Salesforce.php delete mode 100755 vendor/OAuth/OAuth2/Service/ServiceInterface.php delete mode 100755 vendor/OAuth/OAuth2/Service/SoundCloud.php delete mode 100644 vendor/OAuth/OAuth2/Service/Ustream.php delete mode 100755 vendor/OAuth/OAuth2/Service/Vkontakte.php delete mode 100755 vendor/OAuth/OAuth2/Service/Yammer.php delete mode 100755 vendor/OAuth/OAuth2/Token/StdOAuth2Token.php delete mode 100755 vendor/OAuth/OAuth2/Token/TokenInterface.php delete mode 100755 vendor/OAuth/ServiceFactory.php delete mode 100755 vendor/OAuth/bootstrap.php (limited to 'vendor/OAuth') diff --git a/vendor/OAuth/Common/AutoLoader.php b/vendor/OAuth/Common/AutoLoader.php deleted file mode 100755 index 9fe7951c..00000000 --- a/vendor/OAuth/Common/AutoLoader.php +++ /dev/null @@ -1,81 +0,0 @@ - - */ -class AutoLoader -{ - /** - * @var string The namespace prefix for this instance. - */ - protected $namespace = ''; - - /** - * @var string The filesystem prefix to use for this instance - */ - protected $path = ''; - - /** - * Build the instance of the autoloader - * - * @param string $namespace The prefixed namespace this instance will load - * @param string $path The filesystem path to the root of the namespace - */ - public function __construct($namespace, $path) - { - $this->namespace = ltrim($namespace, '\\'); - $this->path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR; - } - - /** - * Try to load a class - * - * @param string $class The class name to load - * - * @return boolean If the loading was successful - */ - public function load($class) - { - $class = ltrim($class, '\\'); - - if (strpos($class, $this->namespace) === 0) { - $nsparts = explode('\\', $class); - $class = array_pop($nsparts); - $nsparts[] = ''; - $path = $this->path . implode(DIRECTORY_SEPARATOR, $nsparts); - $path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; - - if (file_exists($path)) { - require $path; - - return true; - } - } - - return false; - } - - /** - * Register the autoloader to PHP - * - * @return boolean The status of the registration - */ - public function register() - { - return spl_autoload_register(array($this, 'load')); - } - - /** - * Unregister the autoloader to PHP - * - * @return boolean The status of the unregistration - */ - public function unregister() - { - return spl_autoload_unregister(array($this, 'load')); - } -} diff --git a/vendor/OAuth/Common/Consumer/Credentials.php b/vendor/OAuth/Common/Consumer/Credentials.php deleted file mode 100755 index 8e98e9fa..00000000 --- a/vendor/OAuth/Common/Consumer/Credentials.php +++ /dev/null @@ -1,60 +0,0 @@ -consumerId = $consumerId; - $this->consumerSecret = $consumerSecret; - $this->callbackUrl = $callbackUrl; - } - - /** - * @return string - */ - public function getCallbackUrl() - { - return $this->callbackUrl; - } - - /** - * @return string - */ - public function getConsumerId() - { - return $this->consumerId; - } - - /** - * @return string - */ - public function getConsumerSecret() - { - return $this->consumerSecret; - } -} diff --git a/vendor/OAuth/Common/Consumer/CredentialsInterface.php b/vendor/OAuth/Common/Consumer/CredentialsInterface.php deleted file mode 100755 index a33e54e9..00000000 --- a/vendor/OAuth/Common/Consumer/CredentialsInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -userAgent = $userAgent; - } - - /** - * @param int $redirects Maximum redirects for client - * - * @return ClientInterface - */ - public function setMaxRedirects($redirects) - { - $this->maxRedirects = $redirects; - - return $this; - } - - /** - * @param int $timeout Request timeout time for client in seconds - * - * @return ClientInterface - */ - public function setTimeout($timeout) - { - $this->timeout = $timeout; - - return $this; - } - - /** - * @param array $headers - */ - public function normalizeHeaders(&$headers) - { - // Normalize headers - array_walk( - $headers, - function (&$val, &$key) { - $key = ucfirst(strtolower($key)); - $val = ucfirst(strtolower($key)) . ': ' . $val; - } - ); - } -} diff --git a/vendor/OAuth/Common/Http/Client/ClientInterface.php b/vendor/OAuth/Common/Http/Client/ClientInterface.php deleted file mode 100755 index f9c20226..00000000 --- a/vendor/OAuth/Common/Http/Client/ClientInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - value` pairs) to be passed to `curl_setopt` - * - * @var array - */ - private $parameters = array(); - - /** - * Additional `curl_setopt` parameters - * - * @param array $parameters - */ - public function setCurlParameters(array $parameters) - { - $this->parameters = $parameters; - } - - /** - * @param bool $force - * - * @return CurlClient - */ - public function setForceSSL3($force) - { - $this->forceSSL3 = $force; - - return $this; - } - - /** - * Any implementing HTTP providers should send a request to the provided endpoint with the parameters. - * They should return, in string form, the response body and throw an exception on error. - * - * @param UriInterface $endpoint - * @param mixed $requestBody - * @param array $extraHeaders - * @param string $method - * - * @return string - * - * @throws TokenResponseException - * @throws \InvalidArgumentException - */ - public function retrieveResponse( - UriInterface $endpoint, - $requestBody, - array $extraHeaders = array(), - $method = 'POST' - ) { - // Normalize method name - $method = strtoupper($method); - - $this->normalizeHeaders($extraHeaders); - - if ($method === 'GET' && !empty($requestBody)) { - throw new \InvalidArgumentException('No body expected for "GET" request.'); - } - - if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) { - $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded'; - } - - $extraHeaders['Host'] = 'Host: '.$endpoint->getHost(); - $extraHeaders['Connection'] = 'Connection: close'; - - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri()); - - if ($method === 'POST' || $method === 'PUT') { - if ($requestBody && is_array($requestBody)) { - $requestBody = http_build_query($requestBody, '', '&'); - } - - if ($method === 'PUT') { - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - } else { - curl_setopt($ch, CURLOPT_POST, true); - } - - curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody); - } else { - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); - } - - if ($this->maxRedirects > 0) { - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects); - } - - curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders); - curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); - - foreach ($this->parameters as $key => $value) { - curl_setopt($ch, $key, $value); - } - - if ($this->forceSSL3) { - curl_setopt($ch, CURLOPT_SSLVERSION, 3); - } - - $response = curl_exec($ch); - $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - if (false === $response) { - $errNo = curl_errno($ch); - $errStr = curl_error($ch); - curl_close($ch); - if (empty($errStr)) { - throw new TokenResponseException('Failed to request resource.', $responseCode); - } - throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode); - } - - curl_close($ch); - - return $response; - } -} diff --git a/vendor/OAuth/Common/Http/Client/StreamClient.php b/vendor/OAuth/Common/Http/Client/StreamClient.php deleted file mode 100755 index 7f3c5249..00000000 --- a/vendor/OAuth/Common/Http/Client/StreamClient.php +++ /dev/null @@ -1,92 +0,0 @@ -normalizeHeaders($extraHeaders); - - if ($method === 'GET' && !empty($requestBody)) { - throw new \InvalidArgumentException('No body expected for "GET" request.'); - } - - if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) { - $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded'; - } - - $host = 'Host: '.$endpoint->getHost(); - // Append port to Host if it has been specified - if ($endpoint->hasExplicitPortSpecified()) { - $host .= ':'.$endpoint->getPort(); - } - - $extraHeaders['Host'] = $host; - $extraHeaders['Connection'] = 'Connection: close'; - - if (is_array($requestBody)) { - $requestBody = http_build_query($requestBody, '', '&'); - } - $extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody); - - $context = $this->generateStreamContext($requestBody, $extraHeaders, $method); - - $level = error_reporting(0); - $response = file_get_contents($endpoint->getAbsoluteUri(), false, $context); - error_reporting($level); - if (false === $response) { - $lastError = error_get_last(); - if (is_null($lastError)) { - throw new TokenResponseException('Failed to request resource.'); - } - throw new TokenResponseException($lastError['message']); - } - - return $response; - } - - private function generateStreamContext($body, $headers, $method) - { - return stream_context_create( - array( - 'http' => array( - 'method' => $method, - 'header' => implode("\r\n", array_values($headers)), - 'content' => $body, - 'protocol_version' => '1.1', - 'user_agent' => $this->userAgent, - 'max_redirects' => $this->maxRedirects, - 'timeout' => $this->timeout - ), - ) - ); - } -} diff --git a/vendor/OAuth/Common/Http/Exception/TokenResponseException.php b/vendor/OAuth/Common/Http/Exception/TokenResponseException.php deleted file mode 100755 index c519a223..00000000 --- a/vendor/OAuth/Common/Http/Exception/TokenResponseException.php +++ /dev/null @@ -1,12 +0,0 @@ -parseUri($uri); - } - } - - /** - * @param string $uri - * - * @throws \InvalidArgumentException - */ - protected function parseUri($uri) - { - if (false === ($uriParts = parse_url($uri))) { - // congratulations if you've managed to get parse_url to fail, - // it seems to always return some semblance of a parsed url no matter what - throw new InvalidArgumentException("Invalid URI: $uri"); - } - - if (!isset($uriParts['scheme'])) { - throw new InvalidArgumentException('Invalid URI: http|https scheme required'); - } - - $this->scheme = $uriParts['scheme']; - $this->host = $uriParts['host']; - - if (isset($uriParts['port'])) { - $this->port = $uriParts['port']; - $this->explicitPortSpecified = true; - } else { - $this->port = strcmp('https', $uriParts['scheme']) ? 80 : 443; - $this->explicitPortSpecified = false; - } - - if (isset($uriParts['path'])) { - $this->path = $uriParts['path']; - if ('/' === $uriParts['path']) { - $this->explicitTrailingHostSlash = true; - } - } else { - $this->path = '/'; - } - - $this->query = isset($uriParts['query']) ? $uriParts['query'] : ''; - $this->fragment = isset($uriParts['fragment']) ? $uriParts['fragment'] : ''; - - $userInfo = ''; - if (!empty($uriParts['user'])) { - $userInfo .= $uriParts['user']; - } - if ($userInfo && !empty($uriParts['pass'])) { - $userInfo .= ':' . $uriParts['pass']; - } - - $this->setUserInfo($userInfo); - } - - /** - * @param string $rawUserInfo - * - * @return string - */ - protected function protectUserInfo($rawUserInfo) - { - $colonPos = strpos($rawUserInfo, ':'); - - // rfc3986-3.2.1 | http://tools.ietf.org/html/rfc3986#section-3.2 - // "Applications should not render as clear text any data - // after the first colon (":") character found within a userinfo - // subcomponent unless the data after the colon is the empty string - // (indicating no password)" - if ($colonPos !== false && strlen($rawUserInfo)-1 > $colonPos) { - return substr($rawUserInfo, 0, $colonPos) . ':********'; - } else { - return $rawUserInfo; - } - } - - /** - * @return string - */ - public function getScheme() - { - return $this->scheme; - } - - /** - * @return string - */ - public function getUserInfo() - { - return $this->userInfo; - } - - /** - * @return string - */ - public function getRawUserInfo() - { - return $this->rawUserInfo; - } - - /** - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * @return string - */ - public function getQuery() - { - return $this->query; - } - - /** - * @return string - */ - public function getFragment() - { - return $this->fragment; - } - - /** - * Uses protected user info by default as per rfc3986-3.2.1 - * Uri::getRawAuthority() is available if plain-text password information is desirable. - * - * @return string - */ - public function getAuthority() - { - $authority = $this->userInfo ? $this->userInfo.'@' : ''; - $authority .= $this->host; - - if ($this->explicitPortSpecified) { - $authority .= ":{$this->port}"; - } - - return $authority; - } - - /** - * @return string - */ - public function getRawAuthority() - { - $authority = $this->rawUserInfo ? $this->rawUserInfo.'@' : ''; - $authority .= $this->host; - - if ($this->explicitPortSpecified) { - $authority .= ":{$this->port}"; - } - - return $authority; - } - - /** - * @return string - */ - public function getAbsoluteUri() - { - $uri = $this->scheme . '://' . $this->getRawAuthority(); - - if ('/' === $this->path) { - $uri .= $this->explicitTrailingHostSlash ? '/' : ''; - } else { - $uri .= $this->path; - } - - if (!empty($this->query)) { - $uri .= "?{$this->query}"; - } - - if (!empty($this->fragment)) { - $uri .= "#{$this->fragment}"; - } - - return $uri; - } - - /** - * @return string - */ - public function getRelativeUri() - { - $uri = ''; - - if ('/' === $this->path) { - $uri .= $this->explicitTrailingHostSlash ? '/' : ''; - } else { - $uri .= $this->path; - } - - return $uri; - } - - /** - * Uses protected user info by default as per rfc3986-3.2.1 - * Uri::getAbsoluteUri() is available if plain-text password information is desirable. - * - * @return string - */ - public function __toString() - { - $uri = $this->scheme . '://' . $this->getAuthority(); - - if ('/' === $this->path) { - $uri .= $this->explicitTrailingHostSlash ? '/' : ''; - } else { - $uri .= $this->path; - } - - if (!empty($this->query)) { - $uri .= "?{$this->query}"; - } - - if (!empty($this->fragment)) { - $uri .= "#{$this->fragment}"; - } - - return $uri; - } - - /** - * @param $path - */ - public function setPath($path) - { - if (empty($path)) { - $this->path = '/'; - $this->explicitTrailingHostSlash = false; - } else { - $this->path = $path; - if ('/' === $this->path) { - $this->explicitTrailingHostSlash = true; - } - } - } - - /** - * @param string $query - */ - public function setQuery($query) - { - $this->query = $query; - } - - /** - * @param string $var - * @param string $val - */ - public function addToQuery($var, $val) - { - if (strlen($this->query) > 0) { - $this->query .= '&'; - } - $this->query .= http_build_query(array($var => $val), '', '&'); - } - - /** - * @param string $fragment - */ - public function setFragment($fragment) - { - $this->fragment = $fragment; - } - - /** - * @param string $scheme - */ - public function setScheme($scheme) - { - $this->scheme = $scheme; - } - - - /** - * @param string $userInfo - */ - public function setUserInfo($userInfo) - { - $this->userInfo = $userInfo ? $this->protectUserInfo($userInfo) : ''; - $this->rawUserInfo = $userInfo; - } - - - /** - * @param int $port - */ - public function setPort($port) - { - $this->port = intval($port); - - if (('https' === $this->scheme && $this->port === 443) || ('http' === $this->scheme && $this->port === 80)) { - $this->explicitPortSpecified = false; - } else { - $this->explicitPortSpecified = true; - } - } - - /** - * @param string $host - */ - public function setHost($host) - { - $this->host = $host; - } - - /** - * @return bool - */ - public function hasExplicitTrailingHostSlash() - { - return $this->explicitTrailingHostSlash; - } - - /** - * @return bool - */ - public function hasExplicitPortSpecified() - { - return $this->explicitPortSpecified; - } -} diff --git a/vendor/OAuth/Common/Http/Uri/UriFactory.php b/vendor/OAuth/Common/Http/Uri/UriFactory.php deleted file mode 100755 index 127aa203..00000000 --- a/vendor/OAuth/Common/Http/Uri/UriFactory.php +++ /dev/null @@ -1,168 +0,0 @@ -attemptProxyStyleParse($_server)) { - return $uri; - } - - $scheme = $this->detectScheme($_server); - $host = $this->detectHost($_server); - $port = $this->detectPort($_server); - $path = $this->detectPath($_server); - $query = $this->detectQuery($_server); - - return $this->createFromParts($scheme, '', $host, $port, $path, $query); - } - - /** - * @param string $absoluteUri - * - * @return UriInterface - */ - public function createFromAbsolute($absoluteUri) - { - return new Uri($absoluteUri); - } - - /** - * Factory method to build a URI from parts - * - * @param string $scheme - * @param string $userInfo - * @param string $host - * @param string $port - * @param string $path - * @param string $query - * @param string $fragment - * - * @return UriInterface - */ - public function createFromParts($scheme, $userInfo, $host, $port, $path = '', $query = '', $fragment = '') - { - $uri = new Uri(); - $uri->setScheme($scheme); - $uri->setUserInfo($userInfo); - $uri->setHost($host); - $uri->setPort($port); - $uri->setPath($path); - $uri->setQuery($query); - $uri->setFragment($fragment); - - return $uri; - } - - /** - * @param array $_server - * - * @return UriInterface|null - */ - private function attemptProxyStyleParse($_server) - { - // If the raw HTTP request message arrives with a proxy-style absolute URI in the - // initial request line, the absolute URI is stored in $_SERVER['REQUEST_URI'] and - // we only need to parse that. - if (isset($_server['REQUEST_URI']) && parse_url($_server['REQUEST_URI'], PHP_URL_SCHEME)) { - return new Uri($_server['REQUEST_URI']); - } - - return null; - } - - /** - * @param array $_server - * - * @return string - * - * @throws RuntimeException - */ - private function detectPath($_server) - { - if (isset($_server['REQUEST_URI'])) { - $uri = $_server['REQUEST_URI']; - } elseif (isset($_server['REDIRECT_URL'])) { - $uri = $_server['REDIRECT_URL']; - } else { - throw new RuntimeException('Could not detect URI path from superglobal'); - } - - $queryStr = strpos($uri, '?'); - if ($queryStr !== false) { - $uri = substr($uri, 0, $queryStr); - } - - return $uri; - } - - /** - * @param array $_server - * - * @return string - */ - private function detectHost(array $_server) - { - $host = isset($_server['HTTP_HOST']) ? $_server['HTTP_HOST'] : ''; - - if (strstr($host, ':')) { - $host = parse_url($host, PHP_URL_HOST); - } - - return $host; - } - - /** - * @param array $_server - * - * @return string - */ - private function detectPort(array $_server) - { - return isset($_server['SERVER_PORT']) ? $_server['SERVER_PORT'] : 80; - } - - /** - * @param array $_server - * - * @return string - */ - private function detectQuery(array $_server) - { - return isset($_server['QUERY_STRING']) ? $_server['QUERY_STRING'] : ''; - } - - /** - * Determine URI scheme component from superglobal array - * - * When using ISAPI with IIS, the value will be "off" if the request was - * not made through the HTTPS protocol. As a result, we filter the - * value to a bool. - * - * @param array $_server A super-global $_SERVER array - * - * @return string Returns http or https depending on the URI scheme - */ - private function detectScheme(array $_server) - { - if (isset($_server['HTTPS']) && filter_var($_server['HTTPS'], FILTER_VALIDATE_BOOLEAN)) { - return 'https'; - } else { - return 'http'; - } - } -} diff --git a/vendor/OAuth/Common/Http/Uri/UriFactoryInterface.php b/vendor/OAuth/Common/Http/Uri/UriFactoryInterface.php deleted file mode 100755 index 2b157d84..00000000 --- a/vendor/OAuth/Common/Http/Uri/UriFactoryInterface.php +++ /dev/null @@ -1,42 +0,0 @@ -credentials = $credentials; - $this->httpClient = $httpClient; - $this->storage = $storage; - } - - /** - * @param UriInterface|string $path - * @param UriInterface $baseApiUri - * - * @return UriInterface - * - * @throws Exception - */ - protected function determineRequestUriFromPath($path, UriInterface $baseApiUri = null) - { - if ($path instanceof UriInterface) { - $uri = $path; - } elseif (stripos($path, 'http://') === 0 || stripos($path, 'https://') === 0) { - $uri = new Uri($path); - } else { - if (null === $baseApiUri) { - throw new Exception( - 'An absolute URI must be passed to ServiceInterface::request as no baseApiUri is set.' - ); - } - - $uri = clone $baseApiUri; - if (false !== strpos($path, '?')) { - $parts = explode('?', $path, 2); - $path = $parts[0]; - $query = $parts[1]; - $uri->setQuery($query); - } - - if ($path[0] === '/') { - $path = substr($path, 1); - } - - $uri->setPath($uri->getPath() . $path); - } - - return $uri; - } - - /** - * Accessor to the storage adapter to be able to retrieve tokens - * - * @return TokenStorageInterface - */ - public function getStorage() - { - return $this->storage; - } - - /** - * @return string - */ - public function service() - { - // get class name without backslashes - $classname = get_class($this); - - return preg_replace('/^.*\\\\/', '', $classname); - } -} diff --git a/vendor/OAuth/Common/Service/ServiceInterface.php b/vendor/OAuth/Common/Service/ServiceInterface.php deleted file mode 100755 index 5856a039..00000000 --- a/vendor/OAuth/Common/Service/ServiceInterface.php +++ /dev/null @@ -1,49 +0,0 @@ -tokens = array(); - $this->states = array(); - } - - /** - * {@inheritDoc} - */ - public function retrieveAccessToken($service) - { - if ($this->hasAccessToken($service)) { - return $this->tokens[$service]; - } - - throw new TokenNotFoundException('Token not stored'); - } - - /** - * {@inheritDoc} - */ - public function storeAccessToken($service, TokenInterface $token) - { - $this->tokens[$service] = $token; - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAccessToken($service) - { - return isset($this->tokens[$service]) && $this->tokens[$service] instanceof TokenInterface; - } - - /** - * {@inheritDoc} - */ - public function clearToken($service) - { - if (array_key_exists($service, $this->tokens)) { - unset($this->tokens[$service]); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllTokens() - { - $this->tokens = array(); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function retrieveAuthorizationState($service) - { - if ($this->hasAuthorizationState($service)) { - return $this->states[$service]; - } - - throw new AuthorizationStateNotFoundException('State not stored'); - } - - /** - * {@inheritDoc} - */ - public function storeAuthorizationState($service, $state) - { - $this->states[$service] = $state; - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAuthorizationState($service) - { - return isset($this->states[$service]) && null !== $this->states[$service]; - } - - /** - * {@inheritDoc} - */ - public function clearAuthorizationState($service) - { - if (array_key_exists($service, $this->states)) { - unset($this->states[$service]); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllAuthorizationStates() - { - $this->states = array(); - - // allow chaining - return $this; - } -} diff --git a/vendor/OAuth/Common/Storage/Redis.php b/vendor/OAuth/Common/Storage/Redis.php deleted file mode 100755 index 77318bd6..00000000 --- a/vendor/OAuth/Common/Storage/Redis.php +++ /dev/null @@ -1,230 +0,0 @@ -redis = $redis; - $this->key = $key; - $this->stateKey = $stateKey; - $this->cachedTokens = array(); - $this->cachedStates = array(); - } - - /** - * {@inheritDoc} - */ - public function retrieveAccessToken($service) - { - if (!$this->hasAccessToken($service)) { - throw new TokenNotFoundException('Token not found in redis'); - } - - if (isset($this->cachedTokens[$service])) { - return $this->cachedTokens[$service]; - } - - $val = $this->redis->hget($this->key, $service); - - return $this->cachedTokens[$service] = unserialize($val); - } - - /** - * {@inheritDoc} - */ - public function storeAccessToken($service, TokenInterface $token) - { - // (over)write the token - $this->redis->hset($this->key, $service, serialize($token)); - $this->cachedTokens[$service] = $token; - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAccessToken($service) - { - if (isset($this->cachedTokens[$service]) - && $this->cachedTokens[$service] instanceof TokenInterface - ) { - return true; - } - - return $this->redis->hexists($this->key, $service); - } - - /** - * {@inheritDoc} - */ - public function clearToken($service) - { - $this->redis->hdel($this->key, $service); - unset($this->cachedTokens[$service]); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllTokens() - { - // memory - $this->cachedTokens = array(); - - // redis - $keys = $this->redis->hkeys($this->key); - $me = $this; // 5.3 compat - - // pipeline for performance - $this->redis->pipeline( - function ($pipe) use ($keys, $me) { - foreach ($keys as $k) { - $pipe->hdel($me->getKey(), $k); - } - } - ); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function retrieveAuthorizationState($service) - { - if (!$this->hasAuthorizationState($service)) { - throw new AuthorizationStateNotFoundException('State not found in redis'); - } - - if (isset($this->cachedStates[$service])) { - return $this->cachedStates[$service]; - } - - $val = $this->redis->hget($this->stateKey, $service); - - return $this->cachedStates[$service] = unserialize($val); - } - - /** - * {@inheritDoc} - */ - public function storeAuthorizationState($service, $state) - { - // (over)write the token - $this->redis->hset($this->stateKey, $service, $state); - $this->cachedStates[$service] = $state; - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAuthorizationState($service) - { - if (isset($this->cachedStates[$service]) - && null !== $this->cachedStates[$service] - ) { - return true; - } - - return $this->redis->hexists($this->stateKey, $service); - } - - /** - * {@inheritDoc} - */ - public function clearAuthorizationState($service) - { - $this->redis->hdel($this->stateKey, $service); - unset($this->cachedStates[$service]); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllAuthorizationStates() - { - // memory - $this->cachedStates = array(); - - // redis - $keys = $this->redis->hkeys($this->stateKey); - $me = $this; // 5.3 compat - - // pipeline for performance - $this->redis->pipeline( - function ($pipe) use ($keys, $me) { - foreach ($keys as $k) { - $pipe->hdel($me->getKey(), $k); - } - } - ); - - // allow chaining - return $this; - } - - /** - * @return Predis $redis - */ - public function getRedis() - { - return $this->redis; - } - - /** - * @return string $key - */ - public function getKey() - { - return $this->key; - } -} diff --git a/vendor/OAuth/Common/Storage/Session.php b/vendor/OAuth/Common/Storage/Session.php deleted file mode 100755 index e908a67e..00000000 --- a/vendor/OAuth/Common/Storage/Session.php +++ /dev/null @@ -1,188 +0,0 @@ -startSession = $startSession; - $this->sessionVariableName = $sessionVariableName; - $this->stateVariableName = $stateVariableName; - if (!isset($_SESSION[$sessionVariableName])) { - $_SESSION[$sessionVariableName] = array(); - } - if (!isset($_SESSION[$stateVariableName])) { - $_SESSION[$stateVariableName] = array(); - } - } - - /** - * {@inheritDoc} - */ - public function retrieveAccessToken($service) - { - if ($this->hasAccessToken($service)) { - return unserialize($_SESSION[$this->sessionVariableName][$service]); - } - - throw new TokenNotFoundException('Token not found in session, are you sure you stored it?'); - } - - /** - * {@inheritDoc} - */ - public function storeAccessToken($service, TokenInterface $token) - { - $serializedToken = serialize($token); - - if (isset($_SESSION[$this->sessionVariableName]) - && is_array($_SESSION[$this->sessionVariableName]) - ) { - $_SESSION[$this->sessionVariableName][$service] = $serializedToken; - } else { - $_SESSION[$this->sessionVariableName] = array( - $service => $serializedToken, - ); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAccessToken($service) - { - return isset($_SESSION[$this->sessionVariableName], $_SESSION[$this->sessionVariableName][$service]); - } - - /** - * {@inheritDoc} - */ - public function clearToken($service) - { - if (array_key_exists($service, $_SESSION[$this->sessionVariableName])) { - unset($_SESSION[$this->sessionVariableName][$service]); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllTokens() - { - unset($_SESSION[$this->sessionVariableName]); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function storeAuthorizationState($service, $state) - { - if (isset($_SESSION[$this->stateVariableName]) - && is_array($_SESSION[$this->stateVariableName]) - ) { - $_SESSION[$this->stateVariableName][$service] = $state; - } else { - $_SESSION[$this->stateVariableName] = array( - $service => $state, - ); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAuthorizationState($service) - { - return isset($_SESSION[$this->stateVariableName], $_SESSION[$this->stateVariableName][$service]); - } - - /** - * {@inheritDoc} - */ - public function retrieveAuthorizationState($service) - { - if ($this->hasAuthorizationState($service)) { - return $_SESSION[$this->stateVariableName][$service]; - } - - throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?'); - } - - /** - * {@inheritDoc} - */ - public function clearAuthorizationState($service) - { - if (array_key_exists($service, $_SESSION[$this->stateVariableName])) { - unset($_SESSION[$this->stateVariableName][$service]); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllAuthorizationStates() - { - unset($_SESSION[$this->stateVariableName]); - - // allow chaining - return $this; - } - - public function __destruct() - { - if ($this->startSession) { - session_write_close(); - } - } -} diff --git a/vendor/OAuth/Common/Storage/SymfonySession.php b/vendor/OAuth/Common/Storage/SymfonySession.php deleted file mode 100755 index 6c5fbf60..00000000 --- a/vendor/OAuth/Common/Storage/SymfonySession.php +++ /dev/null @@ -1,200 +0,0 @@ -session = $session; - $this->sessionVariableName = $sessionVariableName; - $this->stateVariableName = $stateVariableName; - } - - /** - * {@inheritDoc} - */ - public function retrieveAccessToken($service) - { - if ($this->hasAccessToken($service)) { - // get from session - $tokens = $this->session->get($this->sessionVariableName); - - // one item - return $tokens[$service]; - } - - throw new TokenNotFoundException('Token not found in session, are you sure you stored it?'); - } - - /** - * {@inheritDoc} - */ - public function storeAccessToken($service, TokenInterface $token) - { - // get previously saved tokens - $tokens = $this->session->get($this->sessionVariableName); - - if (!is_array($tokens)) { - $tokens = array(); - } - - $tokens[$service] = $token; - - // save - $this->session->set($this->sessionVariableName, $tokens); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAccessToken($service) - { - // get from session - $tokens = $this->session->get($this->sessionVariableName); - - return is_array($tokens) - && isset($tokens[$service]) - && $tokens[$service] instanceof TokenInterface; - } - - /** - * {@inheritDoc} - */ - public function clearToken($service) - { - // get previously saved tokens - $tokens = $this->session->get($this->sessionVariableName); - - if (is_array($tokens) && array_key_exists($service, $tokens)) { - unset($tokens[$service]); - - // Replace the stored tokens array - $this->session->set($this->sessionVariableName, $tokens); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllTokens() - { - $this->session->remove($this->sessionVariableName); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function retrieveAuthorizationState($service) - { - if ($this->hasAuthorizationState($service)) { - // get from session - $states = $this->session->get($this->stateVariableName); - - // one item - return $states[$service]; - } - - throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?'); - } - - /** - * {@inheritDoc} - */ - public function storeAuthorizationState($service, $state) - { - // get previously saved tokens - $states = $this->session->get($this->stateVariableName); - - if (!is_array($states)) { - $states = array(); - } - - $states[$service] = $state; - - // save - $this->session->set($this->stateVariableName, $states); - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function hasAuthorizationState($service) - { - // get from session - $states = $this->session->get($this->stateVariableName); - - return is_array($states) - && isset($states[$service]) - && null !== $states[$service]; - } - - /** - * {@inheritDoc} - */ - public function clearAuthorizationState($service) - { - // get previously saved tokens - $states = $this->session->get($this->stateVariableName); - - if (is_array($states) && array_key_exists($service, $states)) { - unset($states[$service]); - - // Replace the stored tokens array - $this->session->set($this->stateVariableName, $states); - } - - // allow chaining - return $this; - } - - /** - * {@inheritDoc} - */ - public function clearAllAuthorizationStates() - { - $this->session->remove($this->stateVariableName); - - // allow chaining - return $this; - } - - /** - * @return Session - */ - public function getSession() - { - return $this->session; - } -} diff --git a/vendor/OAuth/Common/Storage/TokenStorageInterface.php b/vendor/OAuth/Common/Storage/TokenStorageInterface.php deleted file mode 100755 index 46552cee..00000000 --- a/vendor/OAuth/Common/Storage/TokenStorageInterface.php +++ /dev/null @@ -1,98 +0,0 @@ -accessToken = $accessToken; - $this->refreshToken = $refreshToken; - $this->setLifetime($lifetime); - $this->extraParams = $extraParams; - } - - /** - * @return string - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * @return string - */ - public function getRefreshToken() - { - return $this->refreshToken; - } - - /** - * @return int - */ - public function getEndOfLife() - { - return $this->endOfLife; - } - - /** - * @param array $extraParams - */ - public function setExtraParams(array $extraParams) - { - $this->extraParams = $extraParams; - } - - /** - * @return array - */ - public function getExtraParams() - { - return $this->extraParams; - } - - /** - * @param string $accessToken - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - } - - /** - * @param int $endOfLife - */ - public function setEndOfLife($endOfLife) - { - $this->endOfLife = $endOfLife; - } - - /** - * @param int $lifetime - */ - public function setLifetime($lifetime) - { - if (0 === $lifetime || static::EOL_NEVER_EXPIRES === $lifetime) { - $this->endOfLife = static::EOL_NEVER_EXPIRES; - } elseif (null !== $lifetime) { - $this->endOfLife = intval($lifetime) + time(); - } else { - $this->endOfLife = static::EOL_UNKNOWN; - } - } - - /** - * @param string $refreshToken - */ - public function setRefreshToken($refreshToken) - { - $this->refreshToken = $refreshToken; - } - - public function isExpired() - { - return ($this->getEndOfLife() !== TokenInterface::EOL_NEVER_EXPIRES - && $this->getEndOfLife() !== TokenInterface::EOL_UNKNOWN - && time() > $this->getEndOfLife()); - } -} diff --git a/vendor/OAuth/Common/Token/Exception/ExpiredTokenException.php b/vendor/OAuth/Common/Token/Exception/ExpiredTokenException.php deleted file mode 100755 index 26ad6cc5..00000000 --- a/vendor/OAuth/Common/Token/Exception/ExpiredTokenException.php +++ /dev/null @@ -1,12 +0,0 @@ -signature = $signature; - $this->baseApiUri = $baseApiUri; - - $this->signature->setHashingAlgorithm($this->getSignatureMethod()); - } - - /** - * {@inheritDoc} - */ - public function requestRequestToken() - { - $authorizationHeader = array('Authorization' => $this->buildAuthorizationHeaderForTokenRequest()); - $headers = array_merge($authorizationHeader, $this->getExtraOAuthHeaders()); - - $responseBody = $this->httpClient->retrieveResponse($this->getRequestTokenEndpoint(), array(), $headers); - - $token = $this->parseRequestTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($additionalParameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritDoc} - */ - public function requestAccessToken($token, $verifier, $tokenSecret = null) - { - if (is_null($tokenSecret)) { - $storedRequestToken = $this->storage->retrieveAccessToken($this->service()); - $tokenSecret = $storedRequestToken->getRequestTokenSecret(); - } - $this->signature->setTokenSecret($tokenSecret); - - $bodyParams = array( - 'oauth_verifier' => $verifier, - ); - - $authorizationHeader = array( - 'Authorization' => $this->buildAuthorizationHeaderForAPIRequest( - 'POST', - $this->getAccessTokenEndpoint(), - $this->storage->retrieveAccessToken($this->service()), - $bodyParams - ) - ); - - $headers = array_merge($authorizationHeader, $this->getExtraOAuthHeaders()); - - $responseBody = $this->httpClient->retrieveResponse($this->getAccessTokenEndpoint(), $bodyParams, $headers); - - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * Sends an authenticated API request to the path provided. - * If the path provided is not an absolute URI, the base API Uri (must be passed into constructor) will be used. - * - * @param string|UriInterface $path - * @param string $method HTTP method - * @param array $body Request body if applicable (key/value pairs) - * @param array $extraHeaders Extra headers if applicable. - * These will override service-specific any defaults. - * - * @return string - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = $this->determineRequestUriFromPath($path, $this->baseApiUri); - - /** @var $token StdOAuth1Token */ - $token = $this->storage->retrieveAccessToken($this->service()); - $extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders); - $authorizationHeader = array( - 'Authorization' => $this->buildAuthorizationHeaderForAPIRequest($method, $uri, $token, $body) - ); - $headers = array_merge($authorizationHeader, $extraHeaders); - - return $this->httpClient->retrieveResponse($uri, $body, $headers, $method); - } - - /** - * Return any additional headers always needed for this service implementation's OAuth calls. - * - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array(); - } - - /** - * Return any additional headers always needed for this service implementation's API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array(); - } - - /** - * Builds the authorization header for getting an access or request token. - * - * @param array $extraParameters - * - * @return string - */ - protected function buildAuthorizationHeaderForTokenRequest(array $extraParameters = array()) - { - $parameters = $this->getBasicAuthorizationHeaderInfo(); - $parameters = array_merge($parameters, $extraParameters); - $parameters['oauth_signature'] = $this->signature->getSignature( - $this->getRequestTokenEndpoint(), - $parameters, - 'POST' - ); - - $authorizationHeader = 'OAuth '; - $delimiter = ''; - foreach ($parameters as $key => $value) { - $authorizationHeader .= $delimiter . rawurlencode($key) . '="' . rawurlencode($value) . '"'; - - $delimiter = ', '; - } - - return $authorizationHeader; - } - - /** - * Builds the authorization header for an authenticated API request - * - * @param string $method - * @param UriInterface $uri The uri the request is headed - * @param TokenInterface $token - * @param array $bodyParams Request body if applicable (key/value pairs) - * - * @return string - */ - protected function buildAuthorizationHeaderForAPIRequest( - $method, - UriInterface $uri, - TokenInterface $token, - $bodyParams = null - ) { - $this->signature->setTokenSecret($token->getAccessTokenSecret()); - $parameters = $this->getBasicAuthorizationHeaderInfo(); - if (isset($parameters['oauth_callback'])) { - unset($parameters['oauth_callback']); - } - - $parameters = array_merge($parameters, array('oauth_token' => $token->getAccessToken())); - $parameters = (is_array($bodyParams)) ? array_merge($parameters, $bodyParams) : $parameters; - $parameters['oauth_signature'] = $this->signature->getSignature($uri, $parameters, $method); - - $authorizationHeader = 'OAuth '; - $delimiter = ''; - - foreach ($parameters as $key => $value) { - $authorizationHeader .= $delimiter . rawurlencode($key) . '="' . rawurlencode($value) . '"'; - $delimiter = ', '; - } - - return $authorizationHeader; - } - - /** - * Builds the authorization header array. - * - * @return array - */ - protected function getBasicAuthorizationHeaderInfo() - { - $dateTime = new \DateTime(); - $headerParameters = array( - 'oauth_callback' => $this->credentials->getCallbackUrl(), - 'oauth_consumer_key' => $this->credentials->getConsumerId(), - 'oauth_nonce' => $this->generateNonce(), - 'oauth_signature_method' => $this->getSignatureMethod(), - 'oauth_timestamp' => $dateTime->format('U'), - 'oauth_version' => $this->getVersion(), - ); - - return $headerParameters; - } - - /** - * Pseudo random string generator used to build a unique string to sign each request - * - * @param int $length - * - * @return string - */ - protected function generateNonce($length = 32) - { - $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; - - $nonce = ''; - $maxRand = strlen($characters)-1; - for ($i = 0; $i < $length; $i++) { - $nonce.= $characters[rand(0, $maxRand)]; - } - - return $nonce; - } - - /** - * @return string - */ - protected function getSignatureMethod() - { - return 'HMAC-SHA1'; - } - - /** - * This returns the version used in the authorization header of the requests - * - * @return string - */ - protected function getVersion() - { - return '1.0'; - } - - /** - * Parses the request token response and returns a TokenInterface. - * This is only needed to verify the `oauth_callback_confirmed` parameter. The actual - * parsing logic is contained in the access token parser. - * - * @abstract - * - * @param string $responseBody - * - * @return TokenInterface - * - * @throws TokenResponseException - */ - abstract protected function parseRequestTokenResponse($responseBody); - - /** - * Parses the access token response and returns a TokenInterface. - * - * @abstract - * - * @param string $responseBody - * - * @return TokenInterface - * - * @throws TokenResponseException - */ - abstract protected function parseAccessTokenResponse($responseBody); -} diff --git a/vendor/OAuth/OAuth1/Service/BitBucket.php b/vendor/OAuth/OAuth1/Service/BitBucket.php deleted file mode 100755 index f6d8edfe..00000000 --- a/vendor/OAuth/OAuth1/Service/BitBucket.php +++ /dev/null @@ -1,96 +0,0 @@ -baseApiUri = new Uri('https://bitbucket.org/api/1.0/'); - } - } - - /** - * {@inheritDoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://bitbucket.org/!api/1.0/oauth/request_token'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://bitbucket.org/!api/1.0/oauth/authenticate'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://bitbucket.org/!api/1.0/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/Etsy.php b/vendor/OAuth/OAuth1/Service/Etsy.php deleted file mode 100755 index 30dc331c..00000000 --- a/vendor/OAuth/OAuth1/Service/Etsy.php +++ /dev/null @@ -1,132 +0,0 @@ -baseApiUri = new Uri('https://openapi.etsy.com/v2/'); - } - } - - /** - * {@inheritdoc} - */ - public function getRequestTokenEndpoint() - { - $uri = new Uri($this->baseApiUri . 'oauth/request_token'); - $scopes = $this->getScopes(); - - if (count($scopes)) { - $uri->setQuery('scope=' . implode('%20', $scopes)); - } - - return $uri; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri($this->baseApiUri); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri($this->baseApiUri . 'oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } - - /** - * Set the scopes for permissions - * @see https://www.etsy.com/developers/documentation/getting_started/oauth#section_permission_scopes - * @param array $scopes - * - * @return $this - */ - public function setScopes(array $scopes) - { - if (!is_array($scopes)) { - $scopes = array(); - } - - $this->scopes = $scopes; - return $this; - } - - /** - * Return the defined scopes - * @return array - */ - public function getScopes() - { - return $this->scopes; - } -} diff --git a/vendor/OAuth/OAuth1/Service/FitBit.php b/vendor/OAuth/OAuth1/Service/FitBit.php deleted file mode 100755 index 78032d75..00000000 --- a/vendor/OAuth/OAuth1/Service/FitBit.php +++ /dev/null @@ -1,96 +0,0 @@ -baseApiUri = new Uri('https://api.fitbit.com/1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://api.fitbit.com/oauth/request_token'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.fitbit.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.fitbit.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/Flickr.php b/vendor/OAuth/OAuth1/Service/Flickr.php deleted file mode 100755 index f06d282a..00000000 --- a/vendor/OAuth/OAuth1/Service/Flickr.php +++ /dev/null @@ -1,91 +0,0 @@ -baseApiUri = new Uri('https://api.flickr.com/services/rest/'); - } - } - - public function getRequestTokenEndpoint() - { - return new Uri('https://www.flickr.com/services/oauth/request_token'); - } - - public function getAuthorizationEndpoint() - { - return new Uri('https://www.flickr.com/services/oauth/authorize'); - } - - public function getAccessTokenEndpoint() - { - return new Uri('https://www.flickr.com/services/oauth/access_token'); - } - - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] != 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - return $this->parseAccessTokenResponse($responseBody); - } - - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - if ($data === null || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } - - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = $this->determineRequestUriFromPath('/', $this->baseApiUri); - $uri->addToQuery('method', $path); - - $token = $this->storage->retrieveAccessToken($this->service()); - $extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders); - $authorizationHeader = array( - 'Authorization' => $this->buildAuthorizationHeaderForAPIRequest($method, $uri, $token, $body) - ); - $headers = array_merge($authorizationHeader, $extraHeaders); - - return $this->httpClient->retrieveResponse($uri, $body, $headers, $method); - } -} diff --git a/vendor/OAuth/OAuth1/Service/ScoopIt.php b/vendor/OAuth/OAuth1/Service/ScoopIt.php deleted file mode 100755 index 28bd250b..00000000 --- a/vendor/OAuth/OAuth1/Service/ScoopIt.php +++ /dev/null @@ -1,96 +0,0 @@ -baseApiUri = new Uri('https://www.scoop.it/api/1/'); - } - } - - /** - * {@inheritDoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://www.scoop.it/oauth/request'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.scoop.it/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.scoop.it/oauth/access'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/ServiceInterface.php b/vendor/OAuth/OAuth1/Service/ServiceInterface.php deleted file mode 100755 index 3f91fbf2..00000000 --- a/vendor/OAuth/OAuth1/Service/ServiceInterface.php +++ /dev/null @@ -1,45 +0,0 @@ -baseApiUri = new Uri('https://api.tumblr.com/v2/'); - } - } - - /** - * {@inheritdoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://www.tumblr.com/oauth/request_token'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.tumblr.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.tumblr.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/Twitter.php b/vendor/OAuth/OAuth1/Service/Twitter.php deleted file mode 100755 index f46c34e4..00000000 --- a/vendor/OAuth/OAuth1/Service/Twitter.php +++ /dev/null @@ -1,121 +0,0 @@ -baseApiUri = new Uri('https://api.twitter.com/1.1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://api.twitter.com/oauth/request_token'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - if ($this->authorizationEndpoint != self::ENDPOINT_AUTHENTICATE - && $this->authorizationEndpoint != self::ENDPOINT_AUTHORIZE) { - $this->authorizationEndpoint = self::ENDPOINT_AUTHENTICATE; - } - return new Uri($this->authorizationEndpoint); - } - - /** - * @param string $authorizationEndpoint - * - * @throws Exception - */ - public function setAuthorizationEndpoint($endpoint) - { - if ($endpoint != self::ENDPOINT_AUTHENTICATE && $endpoint != self::ENDPOINT_AUTHORIZE) { - throw new Exception( - sprintf("'%s' is not a correct Twitter authorization endpoint.", $endpoint) - ); - } - $this->authorizationEndpoint = $endpoint; - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.twitter.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/Xing.php b/vendor/OAuth/OAuth1/Service/Xing.php deleted file mode 100755 index 03e3357f..00000000 --- a/vendor/OAuth/OAuth1/Service/Xing.php +++ /dev/null @@ -1,96 +0,0 @@ -baseApiUri = new Uri('https://api.xing.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.xing.com/v1/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.xing.com/v1/access_token'); - } - - /** - * {@inheritdoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://api.xing.com/v1/request_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Service/Yahoo.php b/vendor/OAuth/OAuth1/Service/Yahoo.php deleted file mode 100755 index cff291d4..00000000 --- a/vendor/OAuth/OAuth1/Service/Yahoo.php +++ /dev/null @@ -1,96 +0,0 @@ -baseApiUri = new Uri('https://social.yahooapis.com/v1/'); - } - } - - /** - * {@inheritDoc} - */ - public function getRequestTokenEndpoint() - { - return new Uri('https://api.login.yahoo.com/oauth/v2/get_request_token'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.login.yahoo.com/oauth/v2/request_auth'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.login.yahoo.com/oauth/v2/get_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { - throw new TokenResponseException('Error in retrieving token.'); - } - - return $this->parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth1Token(); - - $token->setRequestToken($data['oauth_token']); - $token->setRequestTokenSecret($data['oauth_token_secret']); - $token->setAccessToken($data['oauth_token']); - $token->setAccessTokenSecret($data['oauth_token_secret']); - - $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); - unset($data['oauth_token'], $data['oauth_token_secret']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php b/vendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php deleted file mode 100755 index 44c36ce7..00000000 --- a/vendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php +++ /dev/null @@ -1,12 +0,0 @@ -credentials = $credentials; - } - - /** - * @param string $algorithm - */ - public function setHashingAlgorithm($algorithm) - { - $this->algorithm = $algorithm; - } - - /** - * @param string $token - */ - public function setTokenSecret($token) - { - $this->tokenSecret = $token; - } - - /** - * @param UriInterface $uri - * @param array $params - * @param string $method - * - * @return string - */ - public function getSignature(UriInterface $uri, array $params, $method = 'POST') - { - parse_str($uri->getQuery(), $queryStringData); - - foreach (array_merge($queryStringData, $params) as $key => $value) { - $signatureData[rawurlencode($key)] = rawurlencode($value); - } - - ksort($signatureData); - - // determine base uri - $baseUri = $uri->getScheme() . '://' . $uri->getRawAuthority(); - - if ('/' === $uri->getPath()) { - $baseUri .= $uri->hasExplicitTrailingHostSlash() ? '/' : ''; - } else { - $baseUri .= $uri->getPath(); - } - - $baseString = strtoupper($method) . '&'; - $baseString .= rawurlencode($baseUri) . '&'; - $baseString .= rawurlencode($this->buildSignatureDataString($signatureData)); - - return base64_encode($this->hash($baseString)); - } - - /** - * @param array $signatureData - * - * @return string - */ - protected function buildSignatureDataString(array $signatureData) - { - $signatureString = ''; - $delimiter = ''; - foreach ($signatureData as $key => $value) { - $signatureString .= $delimiter . $key . '=' . $value; - - $delimiter = '&'; - } - - return $signatureString; - } - - /** - * @return string - */ - protected function getSigningKey() - { - $signingKey = rawurlencode($this->credentials->getConsumerSecret()) . '&'; - if ($this->tokenSecret !== null) { - $signingKey .= rawurlencode($this->tokenSecret); - } - - return $signingKey; - } - - /** - * @param string $data - * - * @return string - * - * @throws UnsupportedHashAlgorithmException - */ - protected function hash($data) - { - switch (strtoupper($this->algorithm)) { - case 'HMAC-SHA1': - return hash_hmac('sha1', $data, $this->getSigningKey(), true); - default: - throw new UnsupportedHashAlgorithmException( - 'Unsupported hashing algorithm (' . $this->algorithm . ') used.' - ); - } - } -} diff --git a/vendor/OAuth/OAuth1/Signature/SignatureInterface.php b/vendor/OAuth/OAuth1/Signature/SignatureInterface.php deleted file mode 100755 index da50ddb6..00000000 --- a/vendor/OAuth/OAuth1/Signature/SignatureInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -requestToken = $requestToken; - } - - /** - * @return string - */ - public function getRequestToken() - { - return $this->requestToken; - } - - /** - * @param string $requestTokenSecret - */ - public function setRequestTokenSecret($requestTokenSecret) - { - $this->requestTokenSecret = $requestTokenSecret; - } - - /** - * @return string - */ - public function getRequestTokenSecret() - { - return $this->requestTokenSecret; - } - - /** - * @param string $accessTokenSecret - */ - public function setAccessTokenSecret($accessTokenSecret) - { - $this->accessTokenSecret = $accessTokenSecret; - } - - /** - * @return string - */ - public function getAccessTokenSecret() - { - return $this->accessTokenSecret; - } -} diff --git a/vendor/OAuth/OAuth1/Token/TokenInterface.php b/vendor/OAuth/OAuth1/Token/TokenInterface.php deleted file mode 100755 index 0bc3f739..00000000 --- a/vendor/OAuth/OAuth1/Token/TokenInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -stateParameterInAuthUrl = $stateParameterInAutUrl; - - foreach ($scopes as $scope) { - if (!$this->isValidScope($scope)) { - throw new InvalidScopeException('Scope ' . $scope . ' is not valid for service ' . get_class($this)); - } - } - - $this->scopes = $scopes; - - $this->baseApiUri = $baseApiUri; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - if ($this->needsStateParameterInAuthUrl()) { - if (!isset($parameters['state'])) { - $parameters['state'] = $this->generateAuthorizationState(); - } - $this->storeAuthorizationState($parameters['state']); - } - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function requestAccessToken($code, $state = null) - { - if (null !== $state) { - $this->validateAuthorizationState($state); - } - - $bodyParams = array( - 'code' => $code, - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * Sends an authenticated API request to the path provided. - * If the path provided is not an absolute URI, the base API Uri (must be passed into constructor) will be used. - * - * @param string|UriInterface $path - * @param string $method HTTP method - * @param array $body Request body if applicable. - * @param array $extraHeaders Extra headers if applicable. These will override service-specific - * any defaults. - * - * @return string - * - * @throws ExpiredTokenException - * @throws Exception - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = $this->determineRequestUriFromPath($path, $this->baseApiUri); - $token = $this->storage->retrieveAccessToken($this->service()); - - if ($token->getEndOfLife() !== TokenInterface::EOL_NEVER_EXPIRES - && $token->getEndOfLife() !== TokenInterface::EOL_UNKNOWN - && time() > $token->getEndOfLife() - ) { - throw new ExpiredTokenException( - sprintf( - 'Token expired on %s at %s', - date('m/d/Y', $token->getEndOfLife()), - date('h:i:s A', $token->getEndOfLife()) - ) - ); - } - - // add the token where it may be needed - if (static::AUTHORIZATION_METHOD_HEADER_OAUTH === $this->getAuthorizationMethod()) { - $extraHeaders = array_merge(array('Authorization' => 'OAuth ' . $token->getAccessToken()), $extraHeaders); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING === $this->getAuthorizationMethod()) { - $uri->addToQuery('access_token', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V2 === $this->getAuthorizationMethod()) { - $uri->addToQuery('oauth2_access_token', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_QUERY_STRING_V3 === $this->getAuthorizationMethod()) { - $uri->addToQuery('apikey', $token->getAccessToken()); - } elseif (static::AUTHORIZATION_METHOD_HEADER_BEARER === $this->getAuthorizationMethod()) { - $extraHeaders = array_merge(array('Authorization' => 'Bearer ' . $token->getAccessToken()), $extraHeaders); - } - - $extraHeaders = array_merge($this->getExtraApiHeaders(), $extraHeaders); - - return $this->httpClient->retrieveResponse($uri, $body, $extraHeaders, $method); - } - - /** - * Accessor to the storage adapter to be able to retrieve tokens - * - * @return TokenStorageInterface - */ - public function getStorage() - { - return $this->storage; - } - - /** - * Refreshes an OAuth2 access token. - * - * @param TokenInterface $token - * - * @return TokenInterface $token - * - * @throws MissingRefreshTokenException - */ - public function refreshAccessToken(TokenInterface $token) - { - $refreshToken = $token->getRefreshToken(); - - if (empty($refreshToken)) { - throw new MissingRefreshTokenException(); - } - - $parameters = array( - 'grant_type' => 'refresh_token', - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'refresh_token' => $refreshToken, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $parameters, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * Return whether or not the passed scope value is valid. - * - * @param string $scope - * - * @return bool - */ - public function isValidScope($scope) - { - $reflectionClass = new \ReflectionClass(get_class($this)); - - return in_array($scope, $reflectionClass->getConstants(), true); - } - - /** - * Check if the given service need to generate a unique state token to build the authorization url - * - * @return bool - */ - public function needsStateParameterInAuthUrl() - { - return $this->stateParameterInAuthUrl; - } - - /** - * Validates the authorization state against a given one - * - * @param string $state - * @throws InvalidAuthorizationStateException - */ - protected function validateAuthorizationState($state) - { - if ($this->retrieveAuthorizationState() !== $state) { - throw new InvalidAuthorizationStateException(); - } - } - - /** - * Generates a random string to be used as state - * - * @return string - */ - protected function generateAuthorizationState() - { - return md5(rand()); - } - - /** - * Retrieves the authorization state for the current service - * - * @return string - */ - protected function retrieveAuthorizationState() - { - return $this->storage->retrieveAuthorizationState($this->service()); - } - - /** - * Stores a given authorization state into the storage - * - * @param string $state - */ - protected function storeAuthorizationState($state) - { - $this->storage->storeAuthorizationState($this->service(), $state); - } - - /** - * Return any additional headers always needed for this service implementation's OAuth calls. - * - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array(); - } - - /** - * Return any additional headers always needed for this service implementation's API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array(); - } - - /** - * Parses the access token response and returns a TokenInterface. - * - * @abstract - * - * @param string $responseBody - * - * @return TokenInterface - * - * @throws TokenResponseException - */ - abstract protected function parseAccessTokenResponse($responseBody); - - /** - * Returns a class constant from ServiceInterface defining the authorization method used for the API - * Header is the sane default. - * - * @return int - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_OAUTH; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Amazon.php b/vendor/OAuth/OAuth2/Service/Amazon.php deleted file mode 100755 index 035d1a55..00000000 --- a/vendor/OAuth/OAuth2/Service/Amazon.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @link https://images-na.ssl-images-amazon.com/images/G/01/lwa/dev/docs/website-developer-guide._TTH_.pdf - */ -class Amazon extends AbstractService -{ - /** - * Defined scopes - * @link https://images-na.ssl-images-amazon.com/images/G/01/lwa/dev/docs/website-developer-guide._TTH_.pdf - */ - const SCOPE_PROFILE = 'profile'; - const SCOPE_POSTAL_CODE = 'postal_code'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.amazon.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.amazon.com/ap/oa'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.amazon.com/ap/oatoken'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error_description'] . '"'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Bitly.php b/vendor/OAuth/OAuth2/Service/Bitly.php deleted file mode 100755 index e01cbc42..00000000 --- a/vendor/OAuth/OAuth2/Service/Bitly.php +++ /dev/null @@ -1,111 +0,0 @@ -baseApiUri = new Uri('https://api-ssl.bitly.com/v3/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://bitly.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api-ssl.bitly.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // I'm invincible!!! - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function requestAccessToken($code, $state = null) - { - if (null !== $state) { - $this->validateAuthorizationState($state); - } - - $bodyParams = array( - 'code' => $code, - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - - // we can scream what we want that we want bitly to return a json encoded string (format=json), but the - // WOAH WATCH YOUR LANGUAGE ;) service doesn't seem to like screaming, hence we need to manually - // parse the result - $parsedResult = array(); - parse_str($responseBody, $parsedResult); - - $token = $this->parseAccessTokenResponse(json_encode($parsedResult)); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Box.php b/vendor/OAuth/OAuth2/Service/Box.php deleted file mode 100755 index 14696c59..00000000 --- a/vendor/OAuth/OAuth2/Service/Box.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @link https://developers.box.com/oauth/ - */ -class Box extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.box.com/2.0/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.box.com/api/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.box.com/api/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Buffer.php b/vendor/OAuth/OAuth2/Service/Buffer.php deleted file mode 100644 index 5905678e..00000000 --- a/vendor/OAuth/OAuth2/Service/Buffer.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @link https://bufferapp.com/developers/api - */ -class Buffer extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - if ($baseApiUri === null) { - $this->baseApiUri = new Uri('https://api.bufferapp.com/1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://bufferapp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.bufferapp.com/1/oauth2/token.json'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function requestRequestToken() - { - $responseBody = $this->httpClient->retrieveResponse( - $this->getRequestTokenEndpoint(), - array( - 'client_key' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $code = $this->parseRequestTokenResponse($responseBody); - - return $code; - } - - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['code'])) { - throw new TokenResponseException('Error in retrieving code.'); - } - return $data['code']; - } - - public function requestAccessToken($code) - { - $bodyParams = array( - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'code' => $code, - 'grant_type' => 'authorization_code', - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if ($data === null || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Dailymotion.php b/vendor/OAuth/OAuth2/Service/Dailymotion.php deleted file mode 100755 index 095a467f..00000000 --- a/vendor/OAuth/OAuth2/Service/Dailymotion.php +++ /dev/null @@ -1,129 +0,0 @@ - - * @link http://www.dailymotion.com/doc/api/authentication.html - */ -class Dailymotion extends AbstractService -{ - /** - * Scopes - * - * @var string - */ - const SCOPE_EMAIL = 'email', - SCOPE_PROFILE = 'userinfo', - SCOPE_VIDEOS = 'manage_videos', - SCOPE_COMMENTS = 'manage_comments', - SCOPE_PLAYLIST = 'manage_playlists', - SCOPE_TILES = 'manage_tiles', - SCOPE_SUBSCRIPTIONS = 'manage_subscriptions', - SCOPE_FRIENDS = 'manage_friends', - SCOPE_FAVORITES = 'manage_favorites', - SCOPE_GROUPS = 'manage_groups'; - - /** - * Dialog form factors - * - * @var string - */ - const DISPLAY_PAGE = 'page', - DISPLAY_POPUP = 'popup', - DISPLAY_MOBILE = 'mobile'; - - /** - * {@inheritdoc} - */ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.dailymotion.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.dailymotion.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.dailymotion.com/oauth/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_OAUTH; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description']) || isset($data['error'])) { - throw new TokenResponseException( - sprintf( - 'Error in retrieving token: "%s"', - isset($data['error_description']) ? $data['error_description'] : $data['error'] - ) - ); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Dropbox.php b/vendor/OAuth/OAuth2/Service/Dropbox.php deleted file mode 100755 index 43ec6c7f..00000000 --- a/vendor/OAuth/OAuth2/Service/Dropbox.php +++ /dev/null @@ -1,111 +0,0 @@ - - * @link https://www.dropbox.com/developers/core/docs - */ -class Dropbox extends AbstractService -{ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.dropbox.com/1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.dropbox.com/1/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.dropbox.com/1/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php b/vendor/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php deleted file mode 100755 index 398df2fd..00000000 --- a/vendor/OAuth/OAuth2/Service/Exception/InvalidAccessTypeException.php +++ /dev/null @@ -1,12 +0,0 @@ - - * Released under the MIT license. - */ - -namespace OAuth\OAuth2\Service\Exception; - -use OAuth\Common\Exception\Exception; - -/** - * Exception thrown when a scope provided to a service is invalid. - */ -class InvalidScopeException extends Exception -{ -} diff --git a/vendor/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php b/vendor/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php deleted file mode 100755 index 21eece6a..00000000 --- a/vendor/OAuth/OAuth2/Service/Exception/MissingRefreshTokenException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * Released under the MIT license. - */ - -namespace OAuth\OAuth2\Service\Exception; - -use OAuth\Common\Exception\Exception; - -/** - * Exception thrown when service is requested to refresh the access token but no refresh token can be found. - */ -class MissingRefreshTokenException extends Exception -{ -} diff --git a/vendor/OAuth/OAuth2/Service/Facebook.php b/vendor/OAuth/OAuth2/Service/Facebook.php deleted file mode 100755 index 80b25c05..00000000 --- a/vendor/OAuth/OAuth2/Service/Facebook.php +++ /dev/null @@ -1,193 +0,0 @@ -baseApiUri = new Uri('https://graph.facebook.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.facebook.com/dialog/oauth'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://graph.facebook.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - // Facebook gives us a query string ... Oh wait. JSON is too simple, understand ? - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['expires'])) { - $token->setLifeTime($data['expires']); - } - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires']); - - $token->setExtraParams($data); - - return $token; - } - - public function getDialogUri($dialogPath, array $parameters) - { - if (!isset($parameters['redirect_uri'])) { - throw new Exception("Redirect uri is mandatory for this request"); - } - $parameters['app_id'] = $this->credentials->getConsumerId(); - $baseUrl = self::WWW_URL . 'dialog/' . $dialogPath; - $query = http_build_query($parameters); - return new Uri($baseUrl . '?' . $query); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Foursquare.php b/vendor/OAuth/OAuth2/Service/Foursquare.php deleted file mode 100755 index fdbabf98..00000000 --- a/vendor/OAuth/OAuth2/Service/Foursquare.php +++ /dev/null @@ -1,81 +0,0 @@ -baseApiUri = new Uri('https://api.foursquare.com/v2/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://foursquare.com/oauth2/authenticate'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://foursquare.com/oauth2/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Foursquare tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - $uri = new Uri($this->baseApiUri . $path); - $uri->addToQuery('v', $this->apiVersionDate); - - return parent::request($uri, $method, $body, $extraHeaders); - } -} diff --git a/vendor/OAuth/OAuth2/Service/GitHub.php b/vendor/OAuth/OAuth2/Service/GitHub.php deleted file mode 100755 index 9fee2ba0..00000000 --- a/vendor/OAuth/OAuth2/Service/GitHub.php +++ /dev/null @@ -1,208 +0,0 @@ -baseApiUri = new Uri('https://api.github.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://github.com/login/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://github.com/login/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Github tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * Used to configure response type -- we want JSON from github, default is query string format - * - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } - - /** - * Required for GitHub API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/vnd.github.beta+json'); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Google.php b/vendor/OAuth/OAuth2/Service/Google.php deleted file mode 100755 index 096876b6..00000000 --- a/vendor/OAuth/OAuth2/Service/Google.php +++ /dev/null @@ -1,158 +0,0 @@ -accessType = $accessType; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://accounts.google.com/o/oauth2/auth?access_type=' . $this->accessType); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://accounts.google.com/o/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Harvest.php b/vendor/OAuth/OAuth2/Service/Harvest.php deleted file mode 100755 index 96fb0f2d..00000000 --- a/vendor/OAuth/OAuth2/Service/Harvest.php +++ /dev/null @@ -1,157 +0,0 @@ -baseApiUri = new Uri('https://api.harvestapp.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'state' => 'optional-csrf-token', - 'response_type' => 'code', - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.harvestapp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.harvestapp.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || ! is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - $token->setRefreshToken($data['refresh_token']); - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * Refreshes an OAuth2 access token. - * - * @param TokenInterface $token - * - * @return TokenInterface $token - * - * @throws MissingRefreshTokenException - */ - public function refreshAccessToken(TokenInterface $token) - { - $refreshToken = $token->getRefreshToken(); - - if (empty($refreshToken)) { - throw new MissingRefreshTokenException(); - } - - $parameters = array( - 'grant_type' => 'refresh_token', - 'type' => 'web_server', - 'client_id' => $this->credentials->getConsumerId(), - 'client_secret' => $this->credentials->getConsumerSecret(), - 'refresh_token' => $refreshToken, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $parameters, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - /** - * @return array - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } - - /** - * Return any additional headers always needed for this service implementation's API calls. - * - * @return array - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Heroku.php b/vendor/OAuth/OAuth2/Service/Heroku.php deleted file mode 100755 index 470cedc3..00000000 --- a/vendor/OAuth/OAuth2/Service/Heroku.php +++ /dev/null @@ -1,123 +0,0 @@ - - * @link https://devcenter.heroku.com/articles/oauth - */ -class Heroku extends AbstractService -{ - /** - * Defined scopes - * @link https://devcenter.heroku.com/articles/oauth#scopes - */ - const SCOPE_GLOBAL = 'global'; - const SCOPE_IDENTITY = 'identity'; - const SCOPE_READ = 'read'; - const SCOPE_WRITE = 'write'; - const SCOPE_READ_PROTECTED = 'read-protected'; - const SCOPE_WRITE_PROTECTED = 'write-protected'; - - /** - * {@inheritdoc} - */ - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.heroku.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://id.heroku.com/oauth/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://id.heroku.com/oauth/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error_description']) || isset($data['error'])) { - throw new TokenResponseException( - sprintf( - 'Error in retrieving token: "%s"', - isset($data['error_description']) ? $data['error_description'] : $data['error'] - ) - ); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/vnd.heroku+json; version=3'); - } - - /** - * {@inheritdoc} - */ - protected function getExtraApiHeaders() - { - return array('Accept' => 'application/vnd.heroku+json; version=3', 'Content-Type' => 'application/json'); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Instagram.php b/vendor/OAuth/OAuth2/Service/Instagram.php deleted file mode 100755 index 49e9c8c9..00000000 --- a/vendor/OAuth/OAuth2/Service/Instagram.php +++ /dev/null @@ -1,85 +0,0 @@ -baseApiUri = new Uri('https://api.instagram.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://api.instagram.com/oauth/authorize/'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.instagram.com/oauth/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Instagram tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Linkedin.php b/vendor/OAuth/OAuth2/Service/Linkedin.php deleted file mode 100755 index bb801e6a..00000000 --- a/vendor/OAuth/OAuth2/Service/Linkedin.php +++ /dev/null @@ -1,102 +0,0 @@ - - * @link http://developer.linkedin.com/documents/authentication - */ -class Linkedin extends AbstractService -{ - /** - * Defined scopes - * @link http://developer.linkedin.com/documents/authentication#granting - */ - const SCOPE_R_BASICPROFILE = 'r_basicprofile'; - const SCOPE_R_FULLPROFILE = 'r_fullprofile'; - const SCOPE_R_EMAILADDRESS = 'r_emailaddress'; - const SCOPE_R_NETWORK = 'r_network'; - const SCOPE_R_CONTACTINFO = 'r_contactinfo'; - const SCOPE_RW_NUS = 'rw_nus'; - const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin'; - const SCOPE_RW_GROUPS = 'rw_groups'; - const SCOPE_W_MESSAGES = 'w_messages'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.linkedin.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.linkedin.com/uas/oauth2/authorization'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.linkedin.com/uas/oauth2/accessToken'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING_V2; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Mailchimp.php b/vendor/OAuth/OAuth2/Service/Mailchimp.php deleted file mode 100755 index 42abd3c1..00000000 --- a/vendor/OAuth/OAuth2/Service/Mailchimp.php +++ /dev/null @@ -1,115 +0,0 @@ -baseApiUri) && $storage->hasAccessToken($this->service())) { - $this->setBaseApiUri($storage->retrieveAccessToken($this->service())); - } - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING_V3; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://login.mailchimp.com/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://login.mailchimp.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - // Parse JSON - $data = json_decode($responseBody, true); - - // Do validation. - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - // Create token object. - $token = new StdOAuth2Token($data['access_token']); - - // Set the right API endpoint. - $this->setBaseApiUri($token); - - // Mailchimp tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - - return $token; - } - - /** - * {@inheritdoc} - */ - public function request($path, $method = 'GET', $body = null, array $extraHeaders = array()) - { - if (is_null($this->baseApiUri)) { - $this->setBaseApiUri($this->storage->retrieveAccessToken($this->service())); - } - - return parent::request($path, $method, $body, $extraHeaders); - } - - /** - * Set the right base endpoint. - * - * @param StdOAuth2Token $token - */ - protected function setBaseApiUri(StdOAuth2Token $token) - { - // Make request uri. - $endpoint = 'https://login.mailchimp.com/oauth2/metadata?oauth_token='. $token->getAccessToken(); - - // Grab meta data about the token. - $response = $this->httpClient->retrieveResponse(new Uri($endpoint), array(), array(), 'GET'); - - // Parse JSON. - $meta = json_decode($response, true); - - // Set base api uri. - $this->baseApiUri = new Uri('https://'. $meta['dc'] .'.api.mailchimp.com/2.0/'); - - // Allow chaining. - return $this; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Microsoft.php b/vendor/OAuth/OAuth2/Service/Microsoft.php deleted file mode 100755 index 183ef452..00000000 --- a/vendor/OAuth/OAuth2/Service/Microsoft.php +++ /dev/null @@ -1,119 +0,0 @@ -baseApiUri = new Uri('https://apis.live.net/v5.0/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://login.live.com/oauth20_authorize.srf'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://login.live.com/oauth20_token.srf'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifetime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Paypal.php b/vendor/OAuth/OAuth2/Service/Paypal.php deleted file mode 100755 index 761c09d6..00000000 --- a/vendor/OAuth/OAuth2/Service/Paypal.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @link https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/detailed/ - */ -class Paypal extends AbstractService -{ - /** - * Defined scopes - * @link https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/detailed/ - * @see #attributes - */ - const SCOPE_OPENID = 'openid'; - const SCOPE_PROFILE = 'profile'; - const SCOPE_PAYPALATTRIBUTES = 'https://uri.paypal.com/services/paypalattributes'; - const SCOPE_EMAIL = 'email'; - const SCOPE_ADDRESS = 'address'; - const SCOPE_PHONE = 'phone'; - const SCOPE_EXPRESSCHECKOUT = 'https://uri.paypal.com/services/expresscheckout'; - - public function __construct( - CredentialsInterface $credentials, - ClientInterface $httpClient, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); - - if (null === $baseApiUri) { - $this->baseApiUri = new Uri('https://api.paypal.com/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.paypal.com/v1/identity/openidconnect/tokenservice'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['message'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['message'] . '"'); - } elseif (isset($data['name'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['name'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Pocket.php b/vendor/OAuth/OAuth2/Service/Pocket.php deleted file mode 100755 index 8c955440..00000000 --- a/vendor/OAuth/OAuth2/Service/Pocket.php +++ /dev/null @@ -1,125 +0,0 @@ -baseApiUri = new Uri('https://getpocket.com/v3/'); - } - } - - public function getRequestTokenEndpoint() - { - return new Uri('https://getpocket.com/v3/oauth/request'); - } - - public function getAuthorizationEndpoint() - { - return new Uri('https://getpocket.com/auth/authorize'); - } - - public function getAccessTokenEndpoint() - { - return new Uri('https://getpocket.com/v3/oauth/authorize'); - } - - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'redirect_uri' => $this->credentials->getCallbackUrl(), - ) - ); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - public function requestRequestToken() - { - $responseBody = $this->httpClient->retrieveResponse( - $this->getRequestTokenEndpoint(), - array( - 'consumer_key' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - ) - ); - - $code = $this->parseRequestTokenResponse($responseBody); - - return $code; - } - - protected function parseRequestTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (!isset($data['code'])) { - throw new TokenResponseException('Error in retrieving code.'); - } - return $data['code']; - } - - public function requestAccessToken($code) - { - $bodyParams = array( - 'consumer_key' => $this->credentials->getConsumerId(), - 'code' => $code, - ); - - $responseBody = $this->httpClient->retrieveResponse( - $this->getAccessTokenEndpoint(), - $bodyParams, - $this->getExtraOAuthHeaders() - ); - $token = $this->parseAccessTokenResponse($responseBody); - $this->storage->storeAccessToken($this->service(), $token); - - return $token; - } - - protected function parseAccessTokenResponse($responseBody) - { - parse_str($responseBody, $data); - - if ($data === null || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - #$token->setRequestToken($data['access_token']); - $token->setAccessToken($data['access_token']); - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Reddit.php b/vendor/OAuth/OAuth2/Service/Reddit.php deleted file mode 100755 index 9e524d12..00000000 --- a/vendor/OAuth/OAuth2/Service/Reddit.php +++ /dev/null @@ -1,114 +0,0 @@ -baseApiUri = new Uri('https://oauth.reddit.com'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://ssl.reddit.com/api/v1/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://ssl.reddit.com/api/v1/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - // Reddit uses a Basic OAuth header - return array('Authorization' => 'Basic ' . - base64_encode($this->credentials->getConsumerId() . ':' . $this->credentials->getConsumerSecret())); - } -} diff --git a/vendor/OAuth/OAuth2/Service/RunKeeper.php b/vendor/OAuth/OAuth2/Service/RunKeeper.php deleted file mode 100755 index 71584076..00000000 --- a/vendor/OAuth/OAuth2/Service/RunKeeper.php +++ /dev/null @@ -1,105 +0,0 @@ -baseApiUri = new Uri('https://api.runkeeper.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationUri(array $additionalParameters = array()) - { - $parameters = array_merge( - $additionalParameters, - array( - 'client_id' => $this->credentials->getConsumerId(), - 'redirect_uri' => $this->credentials->getCallbackUrl(), - 'response_type' => 'code', - ) - ); - - $parameters['scope'] = implode(' ', $this->scopes); - - // Build the url - $url = clone $this->getAuthorizationEndpoint(); - foreach ($parameters as $key => $val) { - $url->addToQuery($key, $val); - } - - return $url; - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://runkeeper.com/apps/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://runkeeper.com/apps/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Salesforce.php b/vendor/OAuth/OAuth2/Service/Salesforce.php deleted file mode 100755 index 583e4347..00000000 --- a/vendor/OAuth/OAuth2/Service/Salesforce.php +++ /dev/null @@ -1,92 +0,0 @@ -parseAccessTokenResponse($responseBody); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - // Salesforce tokens evidently never expire... - $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES); - unset($data['access_token']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Accept' => 'application/json'); - } -} diff --git a/vendor/OAuth/OAuth2/Service/ServiceInterface.php b/vendor/OAuth/OAuth2/Service/ServiceInterface.php deleted file mode 100755 index f3d1bdad..00000000 --- a/vendor/OAuth/OAuth2/Service/ServiceInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -baseApiUri = new Uri('https://api.soundcloud.com/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://soundcloud.com/connect'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://api.soundcloud.com/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - - if (isset($data['expires_in'])) { - $token->setLifetime($data['expires_in']); - unset($data['expires_in']); - } - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Ustream.php b/vendor/OAuth/OAuth2/Service/Ustream.php deleted file mode 100644 index 7e558153..00000000 --- a/vendor/OAuth/OAuth2/Service/Ustream.php +++ /dev/null @@ -1,98 +0,0 @@ -baseApiUri = new Uri('https://api.ustream.tv/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.ustream.tv/oauth2/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.ustream.tv/oauth2/token'); - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getExtraOAuthHeaders() - { - return array('Authorization' => 'Basic ' . $this->credentials->getConsumerSecret()); - } -} diff --git a/vendor/OAuth/OAuth2/Service/Vkontakte.php b/vendor/OAuth/OAuth2/Service/Vkontakte.php deleted file mode 100755 index 4a7744ec..00000000 --- a/vendor/OAuth/OAuth2/Service/Vkontakte.php +++ /dev/null @@ -1,109 +0,0 @@ -baseApiUri = new Uri('https://api.vk.com/method/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://oauth.vk.com/authorize'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://oauth.vk.com/access_token'); - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']); - $token->setLifeTime($data['expires_in']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } - - /** - * {@inheritdoc} - */ - protected function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_QUERY_STRING; - } -} diff --git a/vendor/OAuth/OAuth2/Service/Yammer.php b/vendor/OAuth/OAuth2/Service/Yammer.php deleted file mode 100755 index 994a2935..00000000 --- a/vendor/OAuth/OAuth2/Service/Yammer.php +++ /dev/null @@ -1,82 +0,0 @@ -baseApiUri = new Uri('https://www.yammer.com/api/v1/'); - } - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationEndpoint() - { - return new Uri('https://www.yammer.com/dialog/oauth'); - } - - /** - * {@inheritdoc} - */ - public function getAccessTokenEndpoint() - { - return new Uri('https://www.yammer.com/oauth2/access_token.json'); - } - - /** - * {@inheritdoc} - */ - public function getAuthorizationMethod() - { - return static::AUTHORIZATION_METHOD_HEADER_BEARER; - } - - /** - * {@inheritdoc} - */ - protected function parseAccessTokenResponse($responseBody) - { - $data = json_decode($responseBody, true); - - if (null === $data || !is_array($data)) { - throw new TokenResponseException('Unable to parse response.'); - } elseif (isset($data['error'])) { - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); - } - - $token = new StdOAuth2Token(); - $token->setAccessToken($data['access_token']['token']); - $token->setLifetime($data['access_token']['expires_at']); - - if (isset($data['refresh_token'])) { - $token->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - - unset($data['access_token']); - unset($data['expires_in']); - - $token->setExtraParams($data); - - return $token; - } -} diff --git a/vendor/OAuth/OAuth2/Token/StdOAuth2Token.php b/vendor/OAuth/OAuth2/Token/StdOAuth2Token.php deleted file mode 100755 index eaaacac7..00000000 --- a/vendor/OAuth/OAuth2/Token/StdOAuth2Token.php +++ /dev/null @@ -1,13 +0,0 @@ - - * @author Pieter Hordijk - * @copyright Copyright (c) 2013 The authors - * @license http://www.opensource.org/licenses/mit-license.html MIT License - */ - -namespace OAuth; - -use OAuth\Common\Service\ServiceInterface; -use OAuth\Common\Consumer\CredentialsInterface; -use OAuth\Common\Storage\TokenStorageInterface; -use OAuth\Common\Http\Client\ClientInterface; -use OAuth\Common\Http\Client\StreamClient; -use OAuth\Common\Http\Uri\UriInterface; -use OAuth\Common\Exception\Exception; -use OAuth\OAuth1\Signature\Signature; - -class ServiceFactory -{ - /** - *@var ClientInterface - */ - protected $httpClient; - - /** - * @var array - */ - protected $serviceClassMap = array( - 'OAuth1' => array(), - 'OAuth2' => array() - ); - - /** - * @var array - */ - protected $serviceBuilders = array( - 'OAuth2' => 'buildV2Service', - 'OAuth1' => 'buildV1Service', - ); - - /** - * @param ClientInterface $httpClient - * - * @return ServiceFactory - */ - public function setHttpClient(ClientInterface $httpClient) - { - $this->httpClient = $httpClient; - - return $this; - } - - /** - * Register a custom service to classname mapping. - * - * @param string $serviceName Name of the service - * @param string $className Class to instantiate - * - * @return ServiceFactory - * - * @throws Exception If the class is nonexistent or does not implement a valid ServiceInterface - */ - public function registerService($serviceName, $className) - { - if (!class_exists($className)) { - throw new Exception(sprintf('Service class %s does not exist.', $className)); - } - - $reflClass = new \ReflectionClass($className); - - foreach (array('OAuth2', 'OAuth1') as $version) { - if ($reflClass->implementsInterface('OAuth\\' . $version . '\\Service\\ServiceInterface')) { - $this->serviceClassMap[$version][ucfirst($serviceName)] = $className; - - return $this; - } - } - - throw new Exception(sprintf('Service class %s must implement ServiceInterface.', $className)); - } - - /** - * Builds and returns oauth services - * - * It will first try to build an OAuth2 service and if none found it will try to build an OAuth1 service - * - * @param string $serviceName Name of service to create - * @param CredentialsInterface $credentials - * @param TokenStorageInterface $storage - * @param array|null $scopes If creating an oauth2 service, array of scopes - * @param UriInterface|null $baseApiUri - * - * @return ServiceInterface - */ - public function createService( - $serviceName, - CredentialsInterface $credentials, - TokenStorageInterface $storage, - $scopes = array(), - UriInterface $baseApiUri = null - ) { - if (!$this->httpClient) { - // for backwards compatibility. - $this->httpClient = new StreamClient(); - } - - foreach ($this->serviceBuilders as $version => $buildMethod) { - $fullyQualifiedServiceName = $this->getFullyQualifiedServiceName($serviceName, $version); - - if (class_exists($fullyQualifiedServiceName)) { - return $this->$buildMethod($fullyQualifiedServiceName, $credentials, $storage, $scopes, $baseApiUri); - } - } - - return null; - } - - /** - * Gets the fully qualified name of the service - * - * @param string $serviceName The name of the service of which to get the fully qualified name - * @param string $type The type of the service to get (either OAuth1 or OAuth2) - * - * @return string The fully qualified name of the service - */ - private function getFullyQualifiedServiceName($serviceName, $type) - { - $serviceName = ucfirst($serviceName); - - if (isset($this->serviceClassMap[$type][$serviceName])) { - return $this->serviceClassMap[$type][$serviceName]; - } - - return '\\OAuth\\' . $type . '\\Service\\' . $serviceName; - } - - /** - * Builds v2 services - * - * @param string $serviceName The fully qualified service name - * @param CredentialsInterface $credentials - * @param TokenStorageInterface $storage - * @param array|null $scopes Array of scopes for the service - * @param UriInterface|null $baseApiUri - * - * @return ServiceInterface - * - * @throws Exception - */ - private function buildV2Service( - $serviceName, - CredentialsInterface $credentials, - TokenStorageInterface $storage, - array $scopes, - UriInterface $baseApiUri = null - ) { - return new $serviceName( - $credentials, - $this->httpClient, - $storage, - $this->resolveScopes($serviceName, $scopes), - $baseApiUri - ); - } - - /** - * Resolves scopes for v2 services - * - * @param string $serviceName The fully qualified service name - * @param array $scopes List of scopes for the service - * - * @return array List of resolved scopes - */ - private function resolveScopes($serviceName, array $scopes) - { - $reflClass = new \ReflectionClass($serviceName); - $constants = $reflClass->getConstants(); - - $resolvedScopes = array(); - foreach ($scopes as $scope) { - $key = strtoupper('SCOPE_' . $scope); - - if (array_key_exists($key, $constants)) { - $resolvedScopes[] = $constants[$key]; - } else { - $resolvedScopes[] = $scope; - } - } - - return $resolvedScopes; - } - - /** - * Builds v1 services - * - * @param string $serviceName The fully qualified service name - * @param CredentialsInterface $credentials - * @param TokenStorageInterface $storage - * @param array $scopes - * @param UriInterface $baseApiUri - * - * @return ServiceInterface - * - * @throws Exception - */ - private function buildV1Service( - $serviceName, - CredentialsInterface $credentials, - TokenStorageInterface $storage, - $scopes, - UriInterface $baseApiUri = null - ) { - if (!empty($scopes)) { - throw new Exception( - 'Scopes passed to ServiceFactory::createService but an OAuth1 service was requested.' - ); - } - - return new $serviceName($credentials, $this->httpClient, $storage, new Signature($credentials), $baseApiUri); - } -} diff --git a/vendor/OAuth/bootstrap.php b/vendor/OAuth/bootstrap.php deleted file mode 100755 index 548678aa..00000000 --- a/vendor/OAuth/bootstrap.php +++ /dev/null @@ -1,13 +0,0 @@ -register(); -- cgit v1.2.3