diff options
author | Yukinori Sagara <sagara177@gmail.com> | 2014-08-25 10:53:30 +0900 |
---|---|---|
committer | Yukinori Sagara <sagara177@gmail.com> | 2014-09-01 08:06:07 +0900 |
commit | cf5e45dd5b1ae9b98698a05e7d39989b6bfd4747 (patch) | |
tree | 30debcbe795d4583887beb18bd6349861ec17e8e /keystoneclient/contrib | |
parent | 1643f7da32b1f729f12d042565d8c67f10f91b8c (diff) | |
download | python-keystoneclient-cf5e45dd5b1ae9b98698a05e7d39989b6bfd4747.tar.gz |
fix EC2 Signature Version 4 calculation, in the case of POST
When calculating the AWS Signature Version 4, in the case of POST,
We need to set the CanonicalQueryString to an empty string. this
follows the implementation of the AWS and boto clients.
Change-Id: Iad4e392119067e246c7b77009da3fef48d251382
Closes-Bug: 1360892
Diffstat (limited to 'keystoneclient/contrib')
-rw-r--r-- | keystoneclient/contrib/ec2/utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/keystoneclient/contrib/ec2/utils.py b/keystoneclient/contrib/ec2/utils.py index 3b722f2..899b95a 100644 --- a/keystoneclient/contrib/ec2/utils.py +++ b/keystoneclient/contrib/ec2/utils.py @@ -232,12 +232,19 @@ class Ec2Signer(object): header_list.append('%s:%s' % (h, headers_lower[h])) return '\n'.join(header_list) + '\n' + def canonical_query_str(verb, params): + # POST requests pass parameters in through the request body + canonical_qs = '' + if verb.upper() != 'POST': + canonical_qs = self._canonical_qs(params) + return canonical_qs + # Create canonical request: # http://docs.aws.amazon.com/general/latest/gr/ # sigv4-create-canonical-request.html # Get parameters and headers in expected string format cr = "\n".join((verb.upper(), path, - self._canonical_qs(params), + canonical_query_str(verb, params), canonical_header_str(), auth_param('SignedHeaders'), body_hash)) |