flexera-public / right_aws

RightScale Amazon Web Services Ruby Gems
MIT License
451 stars 175 forks source link

SignatureDoesNotMatch Error on Policy API Request #124

Open cmather opened 12 years ago

cmather commented 12 years ago

I've added a new method to my fork to get and set a bucket's policy since I couldn't find those methods in the s3interface class. I'm new to the code base so please let me know if I'm doing it wrong! However, I'm getting the SignatureDoesNotMatch error from AWS. If I change the url to something like "#{bucket}?location" it works fine. Am I not setting the header url properly? Or, is there something more devious happening? Thanks! Code Below:

module RightAws
  class S3Interface

    def get_bucket_policy(bucket, headers={})
      req_hash = generate_rest_request('GET', headers.merge(url: "#{bucket}?policy"))
      request_info(req_hash, S3HttpResponseBodyParser.new)
    end

  end
end
cmather commented 12 years ago

RightAws::AwsError: SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method. from /Users/cmather/.rvm/gems/ruby-1.9.2-p180@rails31/gems/right_aws-3.0.3/lib/awsbase/right_awsbase.rb:562:in request_info_impl' from /Users/cmather/.rvm/gems/ruby-1.9.2-p180@rails31/gems/right_aws-3.0.3/lib/s3/right_s3_interface.rb:203:inrequest_info' from (irb):27 from /Users/cmather/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `

'

konstantin-dzreev commented 12 years ago

Hi Plz try get_acl method. I guess it does what you need