/** * Computes the authorization signature for file shared key. * * @param array $headers request headers. * @param string $url reuqest url. * @param array $queryParams query variables. * @param string $httpMethod request http method. * * @see File Services (Shared Key Authentication) at * http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx * * @return string */ protected function computeSignature($headers, $url, $queryParams, $httpMethod) { $canonicalizedHeaders = parent::computeCanonicalizedHeaders($headers); $canonicalizedResource = parent::computeCanonicalizedResource($url, $queryParams); $stringToSign = array(); $stringToSign[] = strtoupper($httpMethod); foreach ($this->includedHeaders as $header) { $v = Utilities::tryGetValue($headers, $header); if ($header == Resources::CONTENT_LENGTH && $v == 0) { $v = ''; } $stringToSign[] = $v; } if (count($canonicalizedHeaders) > 0) { $stringToSign[] = implode("\n", $canonicalizedHeaders); } $stringToSign[] = $canonicalizedResource; $stringToSign = implode("\n", $stringToSign); return $stringToSign; }
public function computeSignatureMock($headers, $url, $queryParams, $httpMethod) { return parent::computeSignature($headers, $url, $queryParams, $httpMethod); }