fbauth 1.2.T.2 → 1.2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +0 -5
- data/app/controllers/facebook_auth_functions.rb +4 -3
- data/app/helpers/fbauth_helper.rb +1 -12
- data/app/views/fbauth/_init.html.haml +3 -19
- data/app/views/fbauth/_login.html.haml +4 -4
- data/lib/{fbauth/auth.rb → facebook_auth.rb} +0 -0
- data/lib/{fbauth/config.rb → facebook_config.rb} +0 -0
- data/lib/facebook_decoder.rb +30 -0
- data/lib/{fbauth/graph.rb → facebook_graph.rb} +0 -0
- data/lib/{fbauth/http.rb → facebook_http.rb} +2 -2
- data/lib/{fbauth/query.rb → facebook_query.rb} +0 -0
- data/lib/fbauth.rb +6 -6
- metadata +17 -20
- data/lib/fbauth/decoder.rb +0 -25
- data/public/channel.html +0 -1
data/README.mdown
CHANGED
@@ -227,11 +227,6 @@ haven't (that we recall) come across the answers to these questions yet:
|
|
227
227
|
|
228
228
|
# Change Log #
|
229
229
|
|
230
|
-
v1.2.0.4
|
231
|
-
|
232
|
-
- Added support for Facebook iFrame POST behaviour
|
233
|
-
- Fixed bug in Memcache client where we were using keys > 250 chars
|
234
|
-
|
235
230
|
v1.1.0.2
|
236
231
|
|
237
232
|
- Added memcached caching of Facebook GET data, 60 seconds expiry
|
@@ -4,15 +4,16 @@ module FacebookAuthFunctions
|
|
4
4
|
OLD_FB_SESSION_PARAMS_KEY = :session
|
5
5
|
FB_SIGNED_REQUEST_KEY = :signed_request
|
6
6
|
|
7
|
-
def setup_facebook_auth
|
8
|
-
@facebook_auth
|
7
|
+
def setup_facebook_auth
|
8
|
+
@facebook_auth ||= facebook_auth
|
9
9
|
end
|
10
10
|
|
11
11
|
def require_facebook_auth
|
12
12
|
setup_facebook_auth
|
13
13
|
if @facebook_auth.nil?
|
14
14
|
redirect_to build_auth_url
|
15
|
-
|
15
|
+
end
|
16
|
+
if signed_params_present? && request.post?
|
16
17
|
# If Facebook POST with signed_params, redirect to original URI using GET
|
17
18
|
redirect_to request.request_uri
|
18
19
|
end
|
@@ -8,18 +8,7 @@ module FbauthHelper
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def fbauth_init_javascript options={}
|
11
|
-
render :partial => '/fbauth/init.html.haml', :locals => options
|
12
|
-
end
|
13
|
-
|
14
|
-
def fbauth_build_url path
|
15
|
-
if request.ssl?
|
16
|
-
u = "https://"
|
17
|
-
else
|
18
|
-
u = "http://"
|
19
|
-
end
|
20
|
-
u += request.host
|
21
|
-
u += ":#{request.port}" if request.port != 80
|
22
|
-
u += path
|
11
|
+
render :partial => '/fbauth/init.html.haml', :locals => options
|
23
12
|
end
|
24
13
|
|
25
14
|
def fbauth
|
@@ -1,23 +1,7 @@
|
|
1
1
|
- if auto_resize
|
2
2
|
:javascript
|
3
|
-
|
4
|
-
|
5
|
-
FB.Canvas.setAutoResize();
|
6
|
-
if (typeof window.fbAuthInit == 'function') {
|
7
|
-
window.fbAuthInit();
|
8
|
-
}
|
9
|
-
};
|
3
|
+
FB.init({appId: '#{FacebookConfig['app_id']}', status: true, cookie: true, xfbml: true});
|
4
|
+
FB.Canvas.setAutoResize();
|
10
5
|
- else
|
11
6
|
:javascript
|
12
|
-
|
13
|
-
FB.init({appId: '#{FacebookConfig['app_id']}', status: true, cookie: true, xfbml: true});
|
14
|
-
if (typeof window.fbAuthInit == 'function') {
|
15
|
-
window.fbAuthInit();
|
16
|
-
}
|
17
|
-
};
|
18
|
-
:javascript
|
19
|
-
(function() {
|
20
|
-
var e = document.createElement('script'); e.async = true;
|
21
|
-
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
|
22
|
-
document.getElementById('fb-root').appendChild(e);
|
23
|
-
}());
|
7
|
+
FB.init({appId: '#{FacebookConfig['app_id']}', status: true, cookie: true, xfbml: true});
|
@@ -1,9 +1,9 @@
|
|
1
1
|
:javascript
|
2
|
-
|
2
|
+
$(document).ready(function() {
|
3
3
|
fbauth_hide_panels();
|
4
|
-
|
5
|
-
|
6
|
-
};
|
4
|
+
});
|
5
|
+
FB.getLoginStatus(function(response) { fbauth_update_page(response); });
|
6
|
+
FB.Event.subscribe('auth.statusChange', function(response) { fbauth_update_page(response); });
|
7
7
|
function fbauth_hide_panels() {
|
8
8
|
$('#{login_el}').hide();
|
9
9
|
$('#{add_el}').hide();
|
File without changes
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'digest/sha2'
|
3
|
+
|
4
|
+
class FacebookDecoder
|
5
|
+
|
6
|
+
def self.decode data
|
7
|
+
unless data.nil?
|
8
|
+
sig, b64udata = data.split('.')
|
9
|
+
unless b64udata.nil?
|
10
|
+
json = b64udata.tr('-_', '+/').unpack('m')[0]
|
11
|
+
begin
|
12
|
+
parms = JSON.parse(json)
|
13
|
+
rescue => e
|
14
|
+
begin
|
15
|
+
parms = JSON.parse(json + '"}')
|
16
|
+
rescue => e2
|
17
|
+
begin
|
18
|
+
parms = JSON.parse(json + '}')
|
19
|
+
rescue => e3
|
20
|
+
raise "Unable to parse json structure - '#{json}'"
|
21
|
+
parms = {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
parms
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
File without changes
|
@@ -23,7 +23,7 @@ module FacebookHttp
|
|
23
23
|
json = nil
|
24
24
|
uri = URI.parse(build_get_url(url, params))
|
25
25
|
|
26
|
-
json = Rails.cache.read(uri.to_s) if caching_enabled?
|
26
|
+
json = Rails.cache.read(uri.to_s) if caching_enabled?
|
27
27
|
if json.nil?
|
28
28
|
bench = Benchmark.measure do
|
29
29
|
http = Net::HTTP.new uri.host, uri.port
|
@@ -42,7 +42,7 @@ module FacebookHttp
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
logger.warn("Facebook GET call to #{uri.to_s} completed in #{bench.real} seconds")
|
45
|
-
Rails.cache.write(uri.to_s, json, :expires_in => 60) if
|
45
|
+
Rails.cache.write(uri.to_s, json, :expires_in => 60) if json && caching_enabled?
|
46
46
|
end
|
47
47
|
json
|
48
48
|
end
|
File without changes
|
data/lib/fbauth.rb
CHANGED
@@ -9,9 +9,9 @@
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
require '
|
15
|
-
require '
|
16
|
-
require '
|
17
|
-
require '
|
12
|
+
require 'facebook_decoder.rb'
|
13
|
+
require 'facebook_auth.rb'
|
14
|
+
require 'facebook_config.rb'
|
15
|
+
require 'facebook_http.rb'
|
16
|
+
require 'facebook_graph.rb'
|
17
|
+
require 'facebook_query.rb'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 79
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
-
|
11
|
-
version: 1.2.
|
9
|
+
- 0
|
10
|
+
- 0
|
11
|
+
version: 1.2.0.0
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Three Wise Men Inc.
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-07 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -29,19 +29,18 @@ extensions: []
|
|
29
29
|
extra_rdoc_files:
|
30
30
|
- README.mdown
|
31
31
|
files:
|
32
|
+
- lib/facebook_auth.rb
|
33
|
+
- lib/facebook_config.rb
|
34
|
+
- lib/facebook_decoder.rb
|
35
|
+
- lib/facebook_graph.rb
|
36
|
+
- lib/facebook_http.rb
|
37
|
+
- lib/facebook_query.rb
|
32
38
|
- lib/fbauth.rb
|
33
|
-
- lib/fbauth/auth.rb
|
34
|
-
- lib/fbauth/config.rb
|
35
|
-
- lib/fbauth/decoder.rb
|
36
|
-
- lib/fbauth/graph.rb
|
37
|
-
- lib/fbauth/http.rb
|
38
|
-
- lib/fbauth/query.rb
|
39
39
|
- app/controllers/facebook_auth_functions.rb
|
40
40
|
- app/helpers/fbauth_helper.rb
|
41
41
|
- app/views/fbauth/_init.html.haml
|
42
42
|
- app/views/fbauth/_login.html.haml
|
43
43
|
- rails/init.rb
|
44
|
-
- public/channel.html
|
45
44
|
- README.mdown
|
46
45
|
has_rdoc: true
|
47
46
|
homepage: http://github.com/ThreeWiseMen/fbauth
|
@@ -64,18 +63,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
64
|
none: false
|
66
65
|
requirements:
|
67
|
-
- - "
|
66
|
+
- - ">="
|
68
67
|
- !ruby/object:Gem::Version
|
69
|
-
hash:
|
68
|
+
hash: 3
|
70
69
|
segments:
|
71
|
-
-
|
72
|
-
|
73
|
-
- 1
|
74
|
-
version: 1.3.1
|
70
|
+
- 0
|
71
|
+
version: "0"
|
75
72
|
requirements: []
|
76
73
|
|
77
74
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.3.7
|
79
76
|
signing_key:
|
80
77
|
specification_version: 3
|
81
78
|
summary: Authentication framework for Rails Facebook apps
|
data/lib/fbauth/decoder.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'digest/sha2'
|
3
|
-
|
4
|
-
class FacebookDecoder
|
5
|
-
|
6
|
-
def self.decode data
|
7
|
-
unless data.nil?
|
8
|
-
sig, b64udata = data.split('.')
|
9
|
-
unless b64udata.nil?
|
10
|
-
json = b64udata.tr('-_', '+/').unpack('m')[0]
|
11
|
-
begin
|
12
|
-
parms = JSON.parse(balance(json))
|
13
|
-
rescue => e
|
14
|
-
raise "Unable to parse json structure - '#{json}'"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
parms
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.balance input
|
22
|
-
input += '"' * (input.count('"') % 2)
|
23
|
-
input += "}" * (input.count('{') - input.count('}'))
|
24
|
-
end
|
25
|
-
end
|
data/public/channel.html
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<script src="http://connect.facebook.net/en_US/all.js"></script>
|