facebooker2 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/facebooker2/rails/controller.rb +15 -1
- metadata +4 -4
@@ -28,7 +28,7 @@ module Facebooker2
|
|
28
28
|
return if @_fb_user_fetched
|
29
29
|
# Try to authenticate from the signed request first
|
30
30
|
sig = fetch_client_and_user_from_signed_request
|
31
|
-
sig = fetch_client_and_user_from_cookie
|
31
|
+
sig = fetch_client_and_user_from_cookie if @_current_facebook_client.nil? and !signed_request_from_logged_out_user?
|
32
32
|
|
33
33
|
#write the authentication params to a new cookie
|
34
34
|
if !@_current_facebook_client.nil?
|
@@ -92,6 +92,12 @@ module Facebooker2
|
|
92
92
|
generate_signature(hash,secret) == hash["sig"]
|
93
93
|
end
|
94
94
|
|
95
|
+
# If the signed request is valid but contains no oauth token,
|
96
|
+
# the user is either logged out from Facebook or has not authorized the app
|
97
|
+
def signed_request_from_logged_out_user?
|
98
|
+
!facebook_params.empty? && facebook_params[:oauth_token].nil?
|
99
|
+
end
|
100
|
+
|
95
101
|
# compute the md5 sig based on access_token,expires,uid, and the app secret
|
96
102
|
def generate_signature(hash,secret)
|
97
103
|
sorted_keys = hash.keys.reject {|k| k=="sig"}.sort
|
@@ -188,6 +194,14 @@ module Facebooker2
|
|
188
194
|
#My browser doesn't seem to save the cookie if I set expires
|
189
195
|
cookies[fb_cookie_name] = { :value=>value }#, :expires=>expires}
|
190
196
|
end
|
197
|
+
|
198
|
+
|
199
|
+
# For canvas apps, You need to set the p3p header in order to get IE 6/7 to accept the third-party cookie
|
200
|
+
# For details http://www.softwareprojects.com/resources/programming/t-how-to-get-internet-explorer-to-use-cookies-inside-1612.html
|
201
|
+
def set_p3p_header_for_third_party_cookies
|
202
|
+
response.headers['P3P'] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
|
203
|
+
end
|
204
|
+
|
191
205
|
end
|
192
206
|
end
|
193
207
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebooker2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Mangino
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-01 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|