fb_graph 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fb_graph.gemspec +1 -1
- data/lib/fb_graph/auth/signed_request.rb +7 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.1
|
data/fb_graph.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'base64'
|
2
|
-
require '
|
2
|
+
require 'openssl'
|
3
3
|
|
4
4
|
module FbGraph
|
5
5
|
class Auth
|
@@ -11,13 +11,18 @@ module FbGraph
|
|
11
11
|
signature = base64_url_decode signature
|
12
12
|
data = decode_json base64_url_decode(payload)
|
13
13
|
raise VerificationFailed.new(401, 'Unexpected Signature Algorithm') unless data[:algorithm] == 'HMAC-SHA256'
|
14
|
-
_signature_ =
|
14
|
+
_signature_ = sign(client.secret, payload)
|
15
15
|
raise VerificationFailed.new(401, 'Signature Invalid') unless signature == _signature_
|
16
16
|
data
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
+
def self.sign(key, data)
|
22
|
+
klass = OpenSSL::Digest::SHA256.new
|
23
|
+
OpenSSL::HMAC.digest(klass, key, data)
|
24
|
+
end
|
25
|
+
|
21
26
|
def self.decode_json(json)
|
22
27
|
JSON.parse(json).with_indifferent_access
|
23
28
|
rescue => e
|
metadata
CHANGED