ey_api_hmac 0.0.15 → 0.0.16
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.
- data/Gemfile.lock +1 -1
- data/lib/ey_api_hmac/sso.rb +9 -4
- data/lib/ey_api_hmac/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/ey_api_hmac/sso.rb
CHANGED
@@ -9,7 +9,7 @@ module EY
|
|
9
9
|
verify_params!(url, extra_params, parameters)
|
10
10
|
parameters.merge!(extra_params)
|
11
11
|
end
|
12
|
-
uri.query = parameters
|
12
|
+
uri.query = params_to_string(parameters)
|
13
13
|
signature = CGI.escape(signature_param(uri.to_s, auth_id, auth_key))
|
14
14
|
uri.query += "&signature=#{signature}"
|
15
15
|
uri.to_s
|
@@ -17,9 +17,10 @@ module EY
|
|
17
17
|
|
18
18
|
def self.authenticated?(url, auth_id, auth_key)
|
19
19
|
uri = URI.parse(url)
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
query_params = CGI::parse(uri.query)
|
21
|
+
signature = query_params.delete("signature").to_s
|
22
|
+
uri.query = params_to_string(query_params)
|
23
|
+
signature == signature_param(uri.to_s, auth_id, auth_key)
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.signature_param(signed_string, auth_id, auth_key)
|
@@ -28,6 +29,10 @@ module EY
|
|
28
29
|
|
29
30
|
private
|
30
31
|
|
32
|
+
def self.params_to_string(parameters)
|
33
|
+
parameters.sort_by(&:to_s).map {|e| e.map{|str| CGI.escape(str.to_s)}.join '='}.join '&'
|
34
|
+
end
|
35
|
+
|
31
36
|
def self.verify_params!(url, extra_params, parameters)
|
32
37
|
illegal_query_params = parameters.keys.map(&:to_s) + ["signature"]
|
33
38
|
extra_params.keys.each do |k|
|
data/lib/ey_api_hmac/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_api_hmac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 16
|
10
|
+
version: 0.0.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Jacob Burkhart & Thorben Schr\xC3\xB6der & David Calavera & others"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rack-client
|