56        $authHeader = $this->request->getHeader(
'Authorization');
 
   57        $authHeader = explode(
' ', $authHeader);
 
   59        if ($authHeader[0] != 
'AWS' || !isset($authHeader[1])) {
 
   64        list($this->accessKey, $this->signature) = explode(
':', $authHeader[1]);
 
   89        $contentMD5 = $this->request->getHeader(
'Content-MD5');
 
   93            $body = $this->request->getBody();
 
   94            $this->request->setBody($body);
 
   96            if ($contentMD5 != base64_encode(md5($body, 
true))) {
 
  104        if (!$requestDate = $this->request->getHeader(
'x-amz-date'))
 
  105            $requestDate = $this->request->getHeader(
'Date');
 
  114                $this->request->getMethod() . 
"\n" .
 
  116                $this->request->getHeader(
'Content-type') . 
"\n" .
 
  117                $requestDate . 
"\n" .
 
  119                $this->request->getUrl()
 
  144        $this->response->addHeader(
'WWW-Authenticate', 
'AWS');
 
  145        $this->response->setStatus(401);
 
  171        $min = new \DateTime(
'-15 minutes');
 
  172        $max = new \DateTime(
'+15 minutes');
 
  175        if ($date > $max || $date < $min) {
 
  192        $headers = $this->request->getHeaders();
 
  193        foreach ($headers as $headerName => $headerValue) {
 
  194            if (strpos(strtolower($headerName), 
'x-amz-') === 0) {
 
  195                $amzHeaders[strtolower($headerName)] = str_replace([
"\r\n"], [
' '], $headerValue[0]) . 
"\n";
 
  201        foreach ($amzHeaders as 
$h => $v) {
 
  202            $headerStr .= 
$h . 
':' . $v;
 
  218        if (function_exists(
'hash_hmac')) {
 
  223        if (strlen(
$key) > $blocksize) {
 
  226        $key = str_pad(
$key, $blocksize, chr(0x00));
 
  227        $ipad = str_repeat(chr(0x36), $blocksize);
 
  228        $opad = str_repeat(chr(0x5c), $blocksize);
 
  229        $hmac = pack(
'H*', sha1((
$key ^ $opad) . pack(
'H*', sha1((
$key ^ $ipad) . 
$message))));
 
An exception for terminatinating execution or to throw for unit testing.
HTTP AWS Authentication handler.
getAmzHeaders()
Returns a list of AMZ headers.
validate($secretKey)
Validates the signature based on the secretKey.
const ERR_REQUESTTIMESKEWED
getAccessKey()
Returns the username for the request.
hmacsha1($key, $message)
Generates an HMAC-SHA1 signature.
init()
Gathers all information from the headers.
requireLogin()
Returns an HTTP 401 header, forcing login.
const ERR_INVALIDSIGNATURE
const ERR_MD5CHECKSUMWRONG
const ERR_INVALIDDATEFORMAT
validateRFC2616Date($dateHeader)
Makes sure the supplied value is a valid RFC2616 date.
HTTP Authentication base class.
static parseHTTPDate($dateHeader)
Parses a RFC2616-compatible date string.
catch(Exception $e) $message