escher 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a08450345302a7c0e0b1d789ef7a23850151f234
4
- data.tar.gz: ff3bfb71fba27c558bc3abd9e96331dc8bd1c354
3
+ metadata.gz: d00625f53cdd3b7ad66a39b9cabcea43acb62c0e
4
+ data.tar.gz: f7598ab91680f31be25a6e2e37f92f2cfc30a2eb
5
5
  SHA512:
6
- metadata.gz: 2b68ae2a96d4ccfa0ad1fbbb2966056e316872e140ee984cd8d38eef474faee7c7b4f81b0e33ea654fce0aaa7f3785589fc53b8200b7ad24eb629b58d8ff5138
7
- data.tar.gz: 8ada366ab04fc7895aca5026dcb8a2fc08603cdd604e74979ecb1ad238436b64fc9a07d23fd1d53b23f4c7bdf7b37c3c672abe7205c647ebf10acbd496a84686
6
+ metadata.gz: 7ee2cac687e5f94ed8caac6da7218c420f195416084a03ba8753c589df441cd7e24116e3ac089609f78314b3201c98b2ce0a57f397a33582caf2f43b8f1d8a63
7
+ data.tar.gz: 0b506771ab44ad8bfc8f871cd61137a1b89e64028e492f27ca8d4275da80f35a5a2702c124dd88080ab131b7c2948199c6fdec9ac7b3d6825fefda7235efd108
data/lib/escher/auth.rb CHANGED
@@ -112,6 +112,7 @@ module Escher
112
112
  .split('&', -1)
113
113
  .map { |pair| pair.split('=', -1) }
114
114
  .map { |k, v| (k.include? ' ') ? [k.str(/\S+/), ''] : [k, v] }
115
+ fragment = uri.fragment
115
116
 
116
117
  headers = [['host', host]]
117
118
  headers_to_sign = ['host']
@@ -127,7 +128,7 @@ module Escher
127
128
  signature = generate_signature(client[:api_secret], body, headers, 'GET', headers_to_sign, path, query_parts)
128
129
  query_parts_with_signature = (query_parts.map { |k, v| [uri_encode(k), uri_encode(v)] } << query_pair('Signature', signature))
129
130
 
130
- uri.scheme + '://' + host + path + '?' + query_parts_with_signature.map { |k, v| k + '=' + v }.join('&')
131
+ uri.scheme + '://' + host + path + '?' + query_parts_with_signature.map { |k, v| k + '=' + v }.join('&') + (fragment === nil ? '' : '#' + fragment)
131
132
  end
132
133
 
133
134
 
@@ -1,3 +1,3 @@
1
1
  module Escher
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -172,6 +172,23 @@ module Escher
172
172
  end
173
173
 
174
174
 
175
+ it 'should generate presigned url with hash parameters' do
176
+ escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/11 12:00:00 UTC')))
177
+ expected_url =
178
+ 'http://example.com/something?foo=bar&' + 'baz=barbaz&' +
179
+ 'X-EMS-Algorithm=EMS-HMAC-SHA256&' +
180
+ 'X-EMS-Credentials=th3K3y%2F20110511%2Fus-east-1%2Fhost%2Faws4_request&' +
181
+ 'X-EMS-Date=20110511T120000Z&' +
182
+ 'X-EMS-Expires=123456&' +
183
+ 'X-EMS-SignedHeaders=host&' +
184
+ 'X-EMS-Signature=fbc9dbb91670e84d04ad2ae7505f4f52ab3ff9e192b8233feeae57e9022c2b67' +
185
+ '#hash'
186
+
187
+ client = {:api_key_id => 'th3K3y', :api_secret => 'very_secure'}
188
+ expect(escher.generate_signed_url('http://example.com/something?foo=bar&baz=barbaz#hash', client, 123456)).to eq expected_url
189
+ end
190
+
191
+
175
192
  it 'should validate presigned url' do
176
193
  escher = described_class.new('us-east-1/host/aws4_request', ESCHER_MIXED_OPTIONS.merge(current_time: Time.parse('2011/05/12 21:59:00 UTC')))
177
194
  presigned_uri =
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andras Barthazi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-05 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler