aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/Sabre/HTTP/AWSAuth.php
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/Sabre/HTTP/AWSAuth.php')
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/AWSAuth.php79
1 files changed, 40 insertions, 39 deletions
diff --git a/3rdparty/Sabre/HTTP/AWSAuth.php b/3rdparty/Sabre/HTTP/AWSAuth.php
index 5e4668cd94d..fb8245c8cbf 100644..100755
--- a/3rdparty/Sabre/HTTP/AWSAuth.php
+++ b/3rdparty/Sabre/HTTP/AWSAuth.php
@@ -4,34 +4,34 @@
* HTTP AWS Authentication handler
*
* Use this class to leverage amazon's AWS authentication header
- *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
- * The signature supplied by the HTTP client
- *
- * @var string
+ * The signature supplied by the HTTP client
+ *
+ * @var string
*/
private $signature = null;
/**
- * The accesskey supplied by the HTTP client
- *
- * @var string
+ * The accesskey supplied by the HTTP client
+ *
+ * @var string
*/
private $accessKey = null;
/**
* An error code, if any
*
- * This value will be filled with one of the ERR_* contants
- *
+ * This value will be filled with one of the ERR_* constants
+ *
* @var int
*/
public $errorCode = 0;
@@ -46,8 +46,8 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
* Gathers all information from the headers
*
* This method needs to be called prior to anything else.
- *
- * @return bool
+ *
+ * @return bool
*/
public function init() {
@@ -66,9 +66,9 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Returns the username for the request
- *
- * @return string
+ * Returns the username for the request
+ *
+ * @return string
*/
public function getAccessKey() {
@@ -78,8 +78,9 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
* Validates the signature based on the secretKey
- *
- * @return bool
+ *
+ * @param string $secretKey
+ * @return bool
*/
public function validate($secretKey) {
@@ -89,7 +90,7 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
// We need to validate the integrity of the request
$body = $this->httpRequest->getBody(true);
$this->httpRequest->setBody($body,true);
-
+
if ($contentMD5!=base64_encode(md5($body,true))) {
// content-md5 header did not match md5 signature of body
$this->errorCode = self::ERR_MD5CHECKSUMWRONG;
@@ -98,10 +99,10 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
- if (!$requestDate = $this->httpRequest->getHeader('x-amz-date'))
+ if (!$requestDate = $this->httpRequest->getHeader('x-amz-date'))
$requestDate = $this->httpRequest->getHeader('Date');
- if (!$this->validateRFC2616Date($requestDate))
+ if (!$this->validateRFC2616Date($requestDate))
return false;
$amzHeaders = $this->getAmzHeaders();
@@ -109,10 +110,10 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
$signature = base64_encode(
$this->hmacsha1($secretKey,
$this->httpRequest->getMethod() . "\n" .
- $contentMD5 . "\n" .
+ $contentMD5 . "\n" .
$this->httpRequest->getHeader('Content-type') . "\n" .
$requestDate . "\n" .
- $amzHeaders .
+ $amzHeaders .
$this->httpRequest->getURI()
)
);
@@ -146,14 +147,14 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
* Makes sure the supplied value is a valid RFC2616 date.
*
- * If we would just use strtotime to get a valid timestamp, we have no way of checking if a
+ * If we would just use strtotime to get a valid timestamp, we have no way of checking if a
* user just supplied the word 'now' for the date header.
*
- * This function also makes sure the Date header is within 15 minutes of the operating
+ * This function also makes sure the Date header is within 15 minutes of the operating
* system date, to prevent replay attacks.
- *
- * @param string $dateHeader
- * @return bool
+ *
+ * @param string $dateHeader
+ * @return bool
*/
protected function validateRFC2616Date($dateHeader) {
@@ -177,11 +178,11 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
return $date;
}
-
+
/**
- * Returns a list of AMZ headers
- *
- * @return void
+ * Returns a list of AMZ headers
+ *
+ * @return string
*/
protected function getAmzHeaders() {
@@ -193,7 +194,7 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
}
ksort($amzHeaders);
-
+
$headerStr = '';
foreach($amzHeaders as $h=>$v) {
$headerStr.=$h.':'.$v;
@@ -204,11 +205,11 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Generates an HMAC-SHA1 signature
- *
- * @param string $key
- * @param string $message
- * @return string
+ * Generates an HMAC-SHA1 signature
+ *
+ * @param string $key
+ * @param string $message
+ * @return string
*/
private function hmacsha1($key, $message) {