Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add support for extra auth params

supports authentiction with multiple keypairs
  • Loading branch information...
commit 43496791d9d8270dd2b029623f99e722c11a1a8d 1 parent ef8644f
Felix Gilcher Xylakant authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 clients/php/lib/warden-hmac-signer.php
5 clients/php/lib/warden-hmac-signer.php
View
@@ -111,7 +111,7 @@ public function signRequest($url, $secret, $opts = array()) {
} else {
- $headers[$opts["auth_header"]] = $this->interpolateString($opts["auth_header_format"], array_merge($opts, array("signature" => $signature)));
+ $headers[$opts["auth_header"]] = $this->interpolateString($opts["auth_header_format"], array_merge($opts, $opts["extra_auth_params"], array("signature" => $signature)));
if (!empty($opts["nonce"])) {
$headers[$opts["nonce_header"]] = $opts["nonce"];
}
@@ -198,6 +198,9 @@ protected function interpolateString($formatstring, $replacements) {
#echo $signer->signUrl("http://www.example.org/foo?example=bar&bar=baz#somewhere", "secret", array("date" => "Mon, 20 Jun 2011 12:06:11 GMT"));
#list($headers, $url) = $signer->signRequest("http://example.org?foo=bar&baz=foobar", "secret", array("date" => "Mon, 20 Jun 2011 12:06:11 GMT", "nonce" => "TESTNONCE", "query_based" => true));
+
+
+#list($headers, $url) = $signer->signRequest("http://example.org?foo=bar&baz=foobar", "secret", array("date" => "Mon, 20 Jun 2011 12:06:11 GMT", "nonce" => "TESTNONCE", "auth_header_format" => "%{auth_scheme} %{api_key}:%{signature}", "extra_auth_params" => array("api_key" => "test_api_key"), "query_based" => true));
#
#var_dump($headers);
#echo $url;
Please sign in to comment.
Something went wrong with that request. Please try again.