escher 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/escher/auth.rb +2 -1
- data/lib/escher/version.rb +1 -1
- data/spec/escher/auth_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00625f53cdd3b7ad66a39b9cabcea43acb62c0e
|
4
|
+
data.tar.gz: f7598ab91680f31be25a6e2e37f92f2cfc30a2eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/escher/version.rb
CHANGED
data/spec/escher/auth_spec.rb
CHANGED
@@ -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.
|
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:
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|