authlogic_facebook_koala 0.0.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/README.rdoc +60 -2
  2. data/Rakefile +28 -1
  3. data/VERSION +1 -1
  4. data/authlogic_facebook_koala.gemspec +12 -45
  5. data/lib/authlogic_facebook_koala.rb +10 -4
  6. data/lib/authlogic_facebook_koala/adapter.rb +35 -0
  7. data/lib/authlogic_facebook_koala/config.rb +78 -4
  8. data/lib/authlogic_facebook_koala/session.rb +50 -116
  9. data/test/rails_root/app/controllers/application_controller.rb +10 -0
  10. data/test/rails_root/app/helpers/application_helper.rb +3 -0
  11. data/test/rails_root/app/models/user.rb +7 -0
  12. data/test/{libs → rails_root/app/models}/user_session.rb +0 -0
  13. data/test/rails_root/config/boot.rb +110 -0
  14. data/test/rails_root/config/database.yml +10 -0
  15. data/test/rails_root/config/environment.rb +31 -0
  16. data/test/rails_root/config/environments/development.rb +0 -0
  17. data/test/rails_root/config/environments/test.rb +0 -0
  18. data/test/rails_root/config/facebook.yml +7 -0
  19. data/test/rails_root/config/initializers/authlogic_facebook_koala.rb +5 -0
  20. data/test/rails_root/config/initializers/new_rails_defaults.rb +21 -0
  21. data/test/rails_root/config/initializers/session_store.rb +15 -0
  22. data/test/rails_root/config/locales/en.yml +5 -0
  23. data/test/rails_root/config/routes.rb +43 -0
  24. data/test/rails_root/db/migrate/20101217000008_create_users.rb +37 -0
  25. data/test/rails_root/db/seeds.rb +7 -0
  26. data/test/rails_root/script/console +3 -0
  27. data/test/rails_root/script/dbconsole +3 -0
  28. data/test/rails_root/script/generate +3 -0
  29. data/test/test_helper.rb +19 -58
  30. data/test/units/adapter_test.rb +182 -0
  31. data/test/units/config_test.rb +145 -0
  32. data/test/units/session_test.rb +221 -0
  33. metadata +139 -27
  34. data/lib/authlogic_facebook_koala/controller.rb +0 -59
  35. data/test/libs/user.rb +0 -3
  36. data/test/session_test.rb +0 -30
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic_facebook_koala
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 3
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - James McCarthy
@@ -19,53 +19,123 @@ date: 2010-05-27 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: koala
22
+ name: authlogic
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 1
29
+ hash: 13
30
30
  segments:
31
- - 0
32
- - 7
31
+ - 2
33
32
  - 1
34
- version: 0.7.1
33
+ - 3
34
+ version: 2.1.3
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: authlogic
38
+ name: koala
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 13
45
+ hash: 1
46
46
  segments:
47
- - 2
47
+ - 0
48
+ - 7
48
49
  - 1
49
- - 3
50
- version: 2.1.3
50
+ version: 0.7.1
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- name: test-unit
54
+ name: rails
55
55
  prerelease: false
56
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - "="
60
+ - !ruby/object:Gem::Version
61
+ hash: 9
62
+ segments:
63
+ - 2
64
+ - 3
65
+ - 5
66
+ version: 2.3.5
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: flexmock
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
57
73
  none: false
58
74
  requirements:
59
75
  - - ">="
60
76
  - !ruby/object:Gem::Version
61
77
  hash: 3
62
78
  segments:
63
- - 2
64
79
  - 0
65
- - 6
66
- version: 2.0.6
80
+ version: "0"
67
81
  type: :development
68
- version_requirements: *id003
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: jeweler
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ type: :development
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ prerelease: false
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ type: :development
110
+ version_requirements: *id006
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3-ruby
113
+ prerelease: false
114
+ requirement: &id007 !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ type: :development
124
+ version_requirements: *id007
125
+ - !ruby/object:Gem::Dependency
126
+ name: test-unit
127
+ prerelease: false
128
+ requirement: &id008 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ type: :development
138
+ version_requirements: *id008
69
139
  description: Authlogic plugin to support Facebook Javascript OAuth2 Sessions, using the koala gem for facebook graph access.
70
140
  email: james2mccarthy@gmail.com
71
141
  executables: []
@@ -79,8 +149,8 @@ files:
79
149
  - authlogic_facebook_koala.gemspec
80
150
  - init.rb
81
151
  - lib/authlogic_facebook_koala/acts_as_authentic.rb
152
+ - lib/authlogic_facebook_koala/adapter.rb
82
153
  - lib/authlogic_facebook_koala/config.rb
83
- - lib/authlogic_facebook_koala/controller.rb
84
154
  - lib/authlogic_facebook_koala/helper.rb
85
155
  - lib/authlogic_facebook_koala/session.rb
86
156
  - lib/authlogic_facebook_koala.rb
@@ -88,10 +158,30 @@ files:
88
158
  - rails/init.rb
89
159
  - Rakefile
90
160
  - README.rdoc
161
+ - test/rails_root/app/controllers/application_controller.rb
162
+ - test/rails_root/app/helpers/application_helper.rb
163
+ - test/rails_root/app/models/user.rb
164
+ - test/rails_root/app/models/user_session.rb
165
+ - test/rails_root/config/boot.rb
166
+ - test/rails_root/config/database.yml
167
+ - test/rails_root/config/environment.rb
168
+ - test/rails_root/config/environments/development.rb
169
+ - test/rails_root/config/environments/test.rb
170
+ - test/rails_root/config/facebook.yml
171
+ - test/rails_root/config/initializers/authlogic_facebook_koala.rb
172
+ - test/rails_root/config/initializers/new_rails_defaults.rb
173
+ - test/rails_root/config/initializers/session_store.rb
174
+ - test/rails_root/config/locales/en.yml
175
+ - test/rails_root/config/routes.rb
176
+ - test/rails_root/db/migrate/20101217000008_create_users.rb
177
+ - test/rails_root/db/seeds.rb
178
+ - test/rails_root/script/console
179
+ - test/rails_root/script/dbconsole
180
+ - test/rails_root/script/generate
91
181
  - test/test_helper.rb
92
- - test/session_test.rb
93
- - test/libs/user.rb
94
- - test/libs/user_session.rb
182
+ - test/units/adapter_test.rb
183
+ - test/units/config_test.rb
184
+ - test/units/session_test.rb
95
185
  - VERSION
96
186
  has_rdoc: true
97
187
  homepage: http://github.com/james2m/authlogic_facebook_koala
@@ -116,10 +206,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
206
  requirements:
117
207
  - - ">="
118
208
  - !ruby/object:Gem::Version
119
- hash: 3
209
+ hash: 31
120
210
  segments:
211
+ - 1
212
+ - 2
121
213
  - 0
122
- version: "0"
214
+ version: 1.2.0
123
215
  requirements: []
124
216
 
125
217
  rubyforge_project:
@@ -128,7 +220,27 @@ signing_key:
128
220
  specification_version: 3
129
221
  summary: Authlogic plugin to support Facebook OAuth2 javascript sessions using koala gem
130
222
  test_files:
131
- - test/libs/user.rb
132
- - test/libs/user_session.rb
223
+ - test/rails_root/app/controllers/application_controller.rb
224
+ - test/rails_root/app/helpers/application_helper.rb
225
+ - test/rails_root/app/models/user.rb
226
+ - test/rails_root/app/models/user_session.rb
227
+ - test/rails_root/config/boot.rb
228
+ - test/rails_root/config/database.yml
229
+ - test/rails_root/config/environment.rb
230
+ - test/rails_root/config/environments/development.rb
231
+ - test/rails_root/config/environments/test.rb
232
+ - test/rails_root/config/facebook.yml
233
+ - test/rails_root/config/initializers/authlogic_facebook_koala.rb
234
+ - test/rails_root/config/initializers/new_rails_defaults.rb
235
+ - test/rails_root/config/initializers/session_store.rb
236
+ - test/rails_root/config/locales/en.yml
237
+ - test/rails_root/config/routes.rb
238
+ - test/rails_root/db/migrate/20101217000008_create_users.rb
239
+ - test/rails_root/db/seeds.rb
240
+ - test/rails_root/script/console
241
+ - test/rails_root/script/dbconsole
242
+ - test/rails_root/script/generate
133
243
  - test/test_helper.rb
134
- - test/session_test.rb
244
+ - test/units/adapter_test.rb
245
+ - test/units/config_test.rb
246
+ - test/units/session_test.rb
@@ -1,59 +0,0 @@
1
- require 'ostruct'
2
- module AuthlogicFacebookKoala
3
- module Controller
4
-
5
- def self.included(controller)
6
- controller.send(:helper_method, :facebook_user?, :facebook_user, :facebook_session?, :facebook_session)
7
- end
8
-
9
- # TODO update to use the new facebook_user stuff we are going to create
10
- # can probably kill this now.
11
- def set_current_account_session_from_facebook_session
12
- unless current_account_session
13
- @current_account_session = AccountSession.new
14
- @current_account_session.account = Account.find_by_facebook_uid(facebook_session.user.uid)
15
- end
16
- end
17
-
18
- def facebook_user?
19
- !!facebook_user
20
- end
21
-
22
- def facebook_user
23
- if @facebook_user
24
- return @facebook_user
25
- elsif facebook_session?
26
- facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token)
27
- user = facebook_graph.get_object('me')
28
- user[:uid] = user.delete('id')
29
- return @facebook_user = OpenStruct.new( user )
30
- end
31
- end
32
-
33
- def facebook_session?
34
- !!facebook_session
35
- end
36
-
37
- protected
38
-
39
- def facebook_session
40
- @facebook_session
41
- end
42
-
43
- def set_facebook_session
44
- if @facebook_session
45
- return(@facebook_session)
46
- elsif cookies.has_key?("fbs_#{facebook_params.app_id}")
47
- oauth = Koala::Facebook::OAuth.new(facebook_params.app_id, facebook_params.secret_key)
48
- @facebook_session = OpenStruct.new( oauth.get_user_from_cookie(cookies) )
49
- end
50
- end
51
-
52
- private
53
-
54
- def facebook_params
55
- AuthlogicFacebookKoala::CONFIG
56
- end
57
-
58
- end
59
- end
data/test/libs/user.rb DELETED
@@ -1,3 +0,0 @@
1
- class User < ActiveRecord::Base
2
- acts_as_authentic
3
- end
data/test/session_test.rb DELETED
@@ -1,30 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class SessionTest < ActiveSupport::TestCase
4
- def test_logged_in_with_facebook
5
- session = UserSession.new
6
- assert session.respond_to?(:logged_in_with_facebook?)
7
- end
8
-
9
- def test_validate_openid_error
10
- session = UserSession.new
11
- session.openid_identifier = "yes"
12
- session.openid_identifier = "%"
13
- assert_nil session.openid_identifier
14
- assert !session.save
15
- assert session.errors.on(:openid_identifier)
16
- end
17
-
18
- def test_validate_by_nil_openid_identifier
19
- session = UserSession.new
20
- assert !session.save
21
- assert !redirecting_to_yahoo?
22
- end
23
-
24
- def test_validate_by_correct_openid_identifier
25
- session = UserSession.new
26
- session.openid_identifier = "https://me.yahoo.com/a/9W0FJjRj0o981TMSs0vqVxPdmMUVOQ--"
27
- assert !session.save
28
- assert redirecting_to_yahoo?
29
- end
30
- end