summaryrefslogtreecommitdiff
path: root/vendor/OAuth/OAuth1
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-05-03 22:24:03 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-05-03 22:24:03 -0400
commit560a12f0bd6347a335f8ed5201d6d9562d03d4bc (patch)
tree00510d25c1cf5e747573543fa88d44ef003b1c9a /vendor/OAuth/OAuth1
parent9531e439cd99fb7dbcfb039f422f1d1ba414ec30 (diff)
Add Google authentication
Diffstat (limited to 'vendor/OAuth/OAuth1')
-rwxr-xr-xvendor/OAuth/OAuth1/Service/AbstractService.php311
-rwxr-xr-xvendor/OAuth/OAuth1/Service/BitBucket.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Etsy.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/FitBit.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Flickr.php91
-rwxr-xr-xvendor/OAuth/OAuth1/Service/ScoopIt.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/ServiceInterface.php45
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Tumblr.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Twitter.php121
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Xing.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Service/Yahoo.php96
-rwxr-xr-xvendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php12
-rwxr-xr-xvendor/OAuth/OAuth1/Signature/Signature.php132
-rwxr-xr-xvendor/OAuth/OAuth1/Signature/SignatureInterface.php28
-rwxr-xr-xvendor/OAuth/OAuth1/Token/StdOAuth1Token.php75
-rwxr-xr-xvendor/OAuth/OAuth1/Token/TokenInterface.php41
16 files changed, 1528 insertions, 0 deletions
diff --git a/vendor/OAuth/OAuth1/Service/AbstractService.php b/vendor/OAuth/OAuth1/Service/AbstractService.php
new file mode 100755
index 00000000..0bff5558
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/AbstractService.php
@@ -0,0 +1,311 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Client\ClientInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\TokenInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Service\AbstractService as BaseAbstractService;
+
+abstract class AbstractService extends BaseAbstractService implements ServiceInterface
+{
+ /** @const OAUTH_VERSION */
+ const OAUTH_VERSION = 1;
+
+ /** @var SignatureInterface */
+ protected $signature;
+
+ /** @var UriInterface|null */
+ protected $baseApiUri;
+
+ /**
+ * {@inheritDoc}
+ */
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage);
+
+ $this->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);
+
+ $extraAuthenticationHeaders = array(
+ 'oauth_token' => $token,
+ );
+
+ $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()));
+
+ $mergedParams = (is_array($bodyParams)) ? array_merge($parameters, $bodyParams) : $parameters;
+
+ $parameters['oauth_signature'] = $this->signature->getSignature($uri, $mergedParams, $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
new file mode 100755
index 00000000..f6d8edfe
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/BitBucket.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class BitBucket extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..884358eb
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Etsy.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class Etsy extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->baseApiUri = new Uri('https://openapi.etsy.com/v2/');
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getRequestTokenEndpoint()
+ {
+ return new Uri($this->baseApiUri . 'oauth/request_token');
+ }
+
+ /**
+ * {@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;
+ }
+}
diff --git a/vendor/OAuth/OAuth1/Service/FitBit.php b/vendor/OAuth/OAuth1/Service/FitBit.php
new file mode 100755
index 00000000..78032d75
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/FitBit.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class FitBit extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..f06d282a
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Flickr.php
@@ -0,0 +1,91 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class Flickr extends AbstractService
+{
+
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+ if ($baseApiUri === null) {
+ $this->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
new file mode 100755
index 00000000..28bd250b
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/ScoopIt.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class ScoopIt extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..3f91fbf2
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/ServiceInterface.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Token\TokenInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Service\ServiceInterface as BaseServiceInterface;
+use OAuth\OAuth1\Signature\SignatureInterface;
+
+/**
+ * Defines the common methods across OAuth 1 services.
+ */
+interface ServiceInterface extends BaseServiceInterface
+{
+ /**
+ * Retrieves and stores/returns the OAuth1 request token obtained from the service.
+ *
+ * @return TokenInterface $token
+ *
+ * @throws TokenResponseException
+ */
+ public function requestRequestToken();
+
+ /**
+ * Retrieves and stores/returns the OAuth1 access token after a successful authorization.
+ *
+ * @param string $token The request token from the callback.
+ * @param string $verifier
+ * @param string $tokenSecret
+ *
+ * @return TokenInterface $token
+ *
+ * @throws TokenResponseException
+ */
+ public function requestAccessToken($token, $verifier, $tokenSecret);
+
+ /**
+ * @return UriInterface
+ */
+ public function getRequestTokenEndpoint();
+}
diff --git a/vendor/OAuth/OAuth1/Service/Tumblr.php b/vendor/OAuth/OAuth1/Service/Tumblr.php
new file mode 100755
index 00000000..3f5d38a8
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Tumblr.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class Tumblr extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..f46c34e4
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Twitter.php
@@ -0,0 +1,121 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+use OAuth\Common\Exception\Exception;
+
+class Twitter extends AbstractService
+{
+ const ENDPOINT_AUTHENTICATE = "https://api.twitter.com/oauth/authenticate";
+ const ENDPOINT_AUTHORIZE = "https://api.twitter.com/oauth/authorize";
+
+ protected $authorizationEndpoint = self::ENDPOINT_AUTHENTICATE;
+
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..03e3357f
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Xing.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class Xing extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..cff291d4
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Service/Yahoo.php
@@ -0,0 +1,96 @@
+<?php
+
+namespace OAuth\OAuth1\Service;
+
+use OAuth\OAuth1\Signature\SignatureInterface;
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Http\Exception\TokenResponseException;
+use OAuth\Common\Http\Uri\Uri;
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Http\Client\ClientInterface;
+
+class Yahoo extends AbstractService
+{
+ public function __construct(
+ CredentialsInterface $credentials,
+ ClientInterface $httpClient,
+ TokenStorageInterface $storage,
+ SignatureInterface $signature,
+ UriInterface $baseApiUri = null
+ ) {
+ parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri);
+
+ if (null === $baseApiUri) {
+ $this->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
new file mode 100755
index 00000000..44c36ce7
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Signature/Exception/UnsupportedHashAlgorithmException.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace OAuth\OAuth1\Signature\Exception;
+
+use OAuth\Common\Exception\Exception;
+
+/**
+ * Thrown when an unsupported hash mechanism is requested in signature class.
+ */
+class UnsupportedHashAlgorithmException extends Exception
+{
+}
diff --git a/vendor/OAuth/OAuth1/Signature/Signature.php b/vendor/OAuth/OAuth1/Signature/Signature.php
new file mode 100755
index 00000000..2e13eb37
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Signature/Signature.php
@@ -0,0 +1,132 @@
+<?php
+
+namespace OAuth\OAuth1\Signature;
+
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+use OAuth\OAuth1\Signature\Exception\UnsupportedHashAlgorithmException;
+
+class Signature implements SignatureInterface
+{
+ /**
+ * @var Credentials
+ */
+ protected $credentials;
+
+ /**
+ * @var string
+ */
+ protected $algorithm;
+
+ /**
+ * @var string
+ */
+ protected $tokenSecret = null;
+
+ /**
+ * @param CredentialsInterface $credentials
+ */
+ public function __construct(CredentialsInterface $credentials)
+ {
+ $this->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
new file mode 100755
index 00000000..da50ddb6
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Signature/SignatureInterface.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace OAuth\OAuth1\Signature;
+
+use OAuth\Common\Consumer\CredentialsInterface;
+use OAuth\Common\Http\Uri\UriInterface;
+
+interface SignatureInterface
+{
+ /**
+ * @param string $algorithm
+ */
+ public function setHashingAlgorithm($algorithm);
+
+ /**
+ * @param string $token
+ */
+ public function setTokenSecret($token);
+
+ /**
+ * @param UriInterface $uri
+ * @param array $params
+ * @param string $method
+ *
+ * @return string
+ */
+ public function getSignature(UriInterface $uri, array $params, $method = 'POST');
+}
diff --git a/vendor/OAuth/OAuth1/Token/StdOAuth1Token.php b/vendor/OAuth/OAuth1/Token/StdOAuth1Token.php
new file mode 100755
index 00000000..a12a7971
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Token/StdOAuth1Token.php
@@ -0,0 +1,75 @@
+<?php
+
+namespace OAuth\OAuth1\Token;
+
+use OAuth\Common\Token\AbstractToken;
+
+/**
+ * Standard OAuth1 token implementation.
+ * Implements OAuth\OAuth1\Token\TokenInterface in case of any OAuth1 specific features.
+ */
+class StdOAuth1Token extends AbstractToken implements TokenInterface
+{
+ /**
+ * @var string
+ */
+ protected $requestToken;
+
+ /**
+ * @var string
+ */
+ protected $requestTokenSecret;
+
+ /**
+ * @var string
+ */
+ protected $accessTokenSecret;
+
+ /**
+ * @param string $requestToken
+ */
+ public function setRequestToken($requestToken)
+ {
+ $this->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
new file mode 100755
index 00000000..0bc3f739
--- /dev/null
+++ b/vendor/OAuth/OAuth1/Token/TokenInterface.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace OAuth\OAuth1\Token;
+
+use OAuth\Common\Token\TokenInterface as BaseTokenInterface;
+
+/**
+ * OAuth1 specific token interface
+ */
+interface TokenInterface extends BaseTokenInterface
+{
+ /**
+ * @return string
+ */
+ public function getAccessTokenSecret();
+
+ /**
+ * @param string $accessTokenSecret
+ */
+ public function setAccessTokenSecret($accessTokenSecret);
+
+ /**
+ * @return string
+ */
+ public function getRequestTokenSecret();
+
+ /**
+ * @param string $requestTokenSecret
+ */
+ public function setRequestTokenSecret($requestTokenSecret);
+
+ /**
+ * @return string
+ */
+ public function getRequestToken();
+
+ /**
+ * @param string $requestToken
+ */
+ public function setRequestToken($requestToken);
+}