summaryrefslogtreecommitdiff
path: root/vendor/OAuth/OAuth1/Signature
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/OAuth/OAuth1/Signature')
-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
3 files changed, 0 insertions, 172 deletions
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 @@
-<?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
deleted file mode 100755
index 2e13eb37..00000000
--- a/vendor/OAuth/OAuth1/Signature/Signature.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?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
deleted file mode 100755
index da50ddb6..00000000
--- a/vendor/OAuth/OAuth1/Signature/SignatureInterface.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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');
-}