authlogic-connect-x 0.0.4.05x

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.
Files changed (59) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +248 -0
  3. data/Rakefile +75 -0
  4. data/init.rb +1 -0
  5. data/lib/authlogic-connect.rb +27 -0
  6. data/lib/authlogic_connect/access_token.rb +53 -0
  7. data/lib/authlogic_connect/authlogic_connect.rb +46 -0
  8. data/lib/authlogic_connect/callback_filter.rb +19 -0
  9. data/lib/authlogic_connect/common.rb +10 -0
  10. data/lib/authlogic_connect/common/session.rb +30 -0
  11. data/lib/authlogic_connect/common/state.rb +32 -0
  12. data/lib/authlogic_connect/common/user.rb +77 -0
  13. data/lib/authlogic_connect/common/variables.rb +137 -0
  14. data/lib/authlogic_connect/engine.rb +14 -0
  15. data/lib/authlogic_connect/ext.rb +56 -0
  16. data/lib/authlogic_connect/oauth.rb +14 -0
  17. data/lib/authlogic_connect/oauth/helper.rb +20 -0
  18. data/lib/authlogic_connect/oauth/process.rb +75 -0
  19. data/lib/authlogic_connect/oauth/session.rb +62 -0
  20. data/lib/authlogic_connect/oauth/state.rb +60 -0
  21. data/lib/authlogic_connect/oauth/tokens/aol_token.rb +2 -0
  22. data/lib/authlogic_connect/oauth/tokens/facebook_token.rb +11 -0
  23. data/lib/authlogic_connect/oauth/tokens/get_satisfaction_token.rb +9 -0
  24. data/lib/authlogic_connect/oauth/tokens/google_token.rb +41 -0
  25. data/lib/authlogic_connect/oauth/tokens/linked_in_token.rb +19 -0
  26. data/lib/authlogic_connect/oauth/tokens/meetup_token.rb +12 -0
  27. data/lib/authlogic_connect/oauth/tokens/myspace_token.rb +26 -0
  28. data/lib/authlogic_connect/oauth/tokens/netflix_token.rb +10 -0
  29. data/lib/authlogic_connect/oauth/tokens/oauth_token.rb +144 -0
  30. data/lib/authlogic_connect/oauth/tokens/oauth_token.rb~ +140 -0
  31. data/lib/authlogic_connect/oauth/tokens/ohloh_token.rb +9 -0
  32. data/lib/authlogic_connect/oauth/tokens/opensocial_token.rb +0 -0
  33. data/lib/authlogic_connect/oauth/tokens/twitter_token.rb +8 -0
  34. data/lib/authlogic_connect/oauth/tokens/vimeo_token.rb +18 -0
  35. data/lib/authlogic_connect/oauth/tokens/yahoo_token.rb +19 -0
  36. data/lib/authlogic_connect/oauth/user.rb +63 -0
  37. data/lib/authlogic_connect/oauth/variables.rb +64 -0
  38. data/lib/authlogic_connect/openid.rb +11 -0
  39. data/lib/authlogic_connect/openid/process.rb +74 -0
  40. data/lib/authlogic_connect/openid/session.rb +56 -0
  41. data/lib/authlogic_connect/openid/state.rb +48 -0
  42. data/lib/authlogic_connect/openid/tokens/aol_token.rb +0 -0
  43. data/lib/authlogic_connect/openid/tokens/blogger_token.rb +0 -0
  44. data/lib/authlogic_connect/openid/tokens/flickr_token.rb +0 -0
  45. data/lib/authlogic_connect/openid/tokens/my_openid_token.rb +3 -0
  46. data/lib/authlogic_connect/openid/tokens/openid_token.rb +9 -0
  47. data/lib/authlogic_connect/openid/user.rb +38 -0
  48. data/lib/authlogic_connect/openid/variables.rb +19 -0
  49. data/lib/open_id_authentication.rb +127 -0
  50. data/rails/init.rb +19 -0
  51. data/test/controllers/test_users_controller.rb +21 -0
  52. data/test/libs/database.rb +48 -0
  53. data/test/libs/user.rb +7 -0
  54. data/test/libs/user_session.rb +2 -0
  55. data/test/old.rb +53 -0
  56. data/test/test_authlogic_connect.rb +13 -0
  57. data/test/test_helper.rb +153 -0
  58. data/test/test_user.rb +194 -0
  59. metadata +242 -0
@@ -0,0 +1,194 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ module AuthlogicConnect
4
+ class UserTest < Test::Unit::TestCase
5
+ context "User creation" do
6
+ setup do
7
+ @user = User.new(:login => "viatropos")
8
+ end
9
+
10
+ should "make sure we are loading the models" do
11
+ assert_equal "viatropos", @user.login
12
+ end
13
+
14
+ context "responds to added oauth methods (our oauth api on the user)" do
15
+
16
+ should "have 'access_tokens' method" do
17
+ assert @user.respond_to?(:access_tokens)
18
+ assert_equal [], @user.access_tokens
19
+ end
20
+
21
+ should "have 'active_token' method" do
22
+ assert @user.respond_to?(:active_token)
23
+ assert_equal nil, @user.active_token
24
+ end
25
+
26
+ end
27
+
28
+ context "with controller and session..." do
29
+
30
+ setup do
31
+ controller.params.merge!(:authentication_type => "user")
32
+ Authlogic::Session::Base.controller = controller
33
+ end
34
+
35
+ should "have a valid controller" do
36
+ assert @user.auth_controller
37
+ end
38
+
39
+ should "have auth_params" do
40
+ assert @user.auth_params?
41
+ end
42
+
43
+ should "have an empty 'auth_session'" do
44
+ assert @user.auth_session.empty?
45
+ assert_equal false, @user.auth_session?
46
+ end
47
+
48
+ context "save the user without any parameters" do
49
+
50
+ setup do
51
+ @save_success = @user.save
52
+ end
53
+
54
+ should "be a valid save" do
55
+ assert @save_success
56
+ end
57
+
58
+ should "not be using oauth" do
59
+ assert_equal false, @user.using_oauth?
60
+ end
61
+
62
+ should "not be using openid" do
63
+ assert_equal false, @user.using_openid?
64
+ end
65
+
66
+ end
67
+
68
+ context "with oauth parameters" do
69
+
70
+ setup do
71
+ @user.auth_controller.params.merge!(:oauth_provider => "twitter")
72
+ # mock token
73
+ @token = OAuth::RequestToken.new("twitter", "key", "secret")
74
+ @token.params = {
75
+ :oauth_callback_confirmed => "true",
76
+ :oauth_token_secret=>"secret",
77
+ :oauth_token=>"key"
78
+ }
79
+ @token.consumer = OAuth::Consumer.new("key", "secret",
80
+ :site=>"http://twitter.com",
81
+ :proxy=>nil,
82
+ :oauth_version=>"1.0",
83
+ :request_token_path=>"/oauth/request_token",
84
+ :authorize_path=>"/oauth/authorize",
85
+ :scheme=>:header,
86
+ :signature_method=>"HMAC-SHA1",
87
+ :authorize_url=>"http://twitter.com/oauth/authenticate",
88
+ :access_token_path=>"/oauth/access_token"
89
+ )
90
+ @session_vars = [
91
+ :authentication_type,
92
+ :auth_request_class,
93
+ :oauth_provider,
94
+ :auth_callback_method
95
+ ]
96
+ end
97
+
98
+ should "have an 'oauth_provider'" do
99
+ assert @user.oauth_provider?
100
+ end
101
+
102
+ should "be an 'oauth_request'" do
103
+ assert @user.oauth_request?
104
+ end
105
+
106
+ should "not be an 'oauth_response'" do
107
+ assert_equal false, @user.oauth_response?
108
+ end
109
+
110
+ should "be using oauth" do
111
+ assert @user.using_oauth?
112
+ end
113
+
114
+ should "not be using openid" do
115
+ assert_equal false, @user.using_openid?
116
+ end
117
+
118
+ should "have the correct class (authentication_type == user)" do
119
+ assert @user.correct_request_class?
120
+ end
121
+
122
+ should "realize we are authenticating_with_oauth?" do
123
+ assert @user.authenticating_with_oauth?
124
+ end
125
+
126
+ end
127
+
128
+ context "with openid parameters" do
129
+ setup do
130
+ @user.auth_controller.params.merge!(:openid_identifier => "viatropos.myopenid.com")
131
+ @session_vars = [
132
+ :authentication_type,
133
+ :auth_request_class,
134
+ :openid_identifier,
135
+ :auth_callback_method
136
+ ]
137
+ end
138
+
139
+ should "have an 'openid_identifier'" do
140
+ assert_equal true, @user.openid_identifier?
141
+ end
142
+
143
+ should "be an 'openid_request'" do
144
+ assert @user.openid_request?
145
+ end
146
+
147
+ should "not be an 'openid_response'" do
148
+ assert_equal false, @user.openid_response?
149
+ end
150
+
151
+ should "be using openid" do
152
+ assert @user.using_openid?
153
+ end
154
+
155
+ should "not be using oauth" do
156
+ assert_equal false, @user.using_oauth?
157
+ end
158
+
159
+ should "have the correct class (authentication_type == user)" do
160
+ assert @user.correct_request_class?
161
+ end
162
+
163
+ should "realize we are authenticating_with_openid?" do
164
+ assert @user.authenticating_with_openid?
165
+ end
166
+
167
+ context "and 'save_with_openid', manually checking each step" do
168
+
169
+ setup do
170
+ # mock save
171
+ # this, and the whole redirect process happens
172
+ # but we'll just assume we saved the session data and got the redirect back
173
+ @user.save_openid_session
174
+ @user.save(:skip_redirect => true, :keep_session => true) do
175
+ "I'm the block you want"
176
+ end
177
+ # copy to test controller
178
+ @user.auth_session.each do |key, value|
179
+ @user.auth_controller.session[key] = value
180
+ end
181
+ end
182
+
183
+ teardown do
184
+ @user.destroy
185
+ end
186
+
187
+ end
188
+ end
189
+
190
+ end
191
+ end
192
+
193
+ end
194
+ end
metadata ADDED
@@ -0,0 +1,242 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: authlogic-connect-x
3
+ version: !ruby/object:Gem::Version
4
+ hash: 412529982
5
+ prerelease: true
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 4
10
+ - 05x
11
+ version: 0.0.4.05x
12
+ platform: ruby
13
+ authors:
14
+ - Lance Pollard, Andrew Cove
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-06-14 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: activesupport
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 15
31
+ segments:
32
+ - 2
33
+ - 1
34
+ - 2
35
+ version: 2.1.2
36
+ type: :runtime
37
+ version_requirements: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ name: activerecord
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ hash: 15
47
+ segments:
48
+ - 2
49
+ - 1
50
+ - 2
51
+ version: 2.1.2
52
+ type: :runtime
53
+ version_requirements: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ name: json
56
+ prerelease: false
57
+ requirement: &id003 !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: ruby-openid
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ type: :runtime
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: rack-openid
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 21
91
+ segments:
92
+ - 0
93
+ - 2
94
+ - 1
95
+ version: 0.2.1
96
+ type: :runtime
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ name: oauth
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ type: :runtime
111
+ version_requirements: *id006
112
+ - !ruby/object:Gem::Dependency
113
+ name: oauth2
114
+ prerelease: false
115
+ requirement: &id007 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ type: :runtime
125
+ version_requirements: *id007
126
+ - !ruby/object:Gem::Dependency
127
+ name: authlogic
128
+ prerelease: false
129
+ requirement: &id008 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ type: :runtime
139
+ version_requirements: *id008
140
+ description: Oauth and OpenID made dead simple
141
+ email: lancejpollard@gmail.com, andrewacove@gmail.com
142
+ executables: []
143
+
144
+ extensions: []
145
+
146
+ extra_rdoc_files: []
147
+
148
+ files:
149
+ - README.markdown
150
+ - Rakefile
151
+ - init.rb
152
+ - MIT-LICENSE
153
+ - lib/authlogic-connect.rb
154
+ - lib/authlogic_connect/access_token.rb
155
+ - lib/authlogic_connect/authlogic_connect.rb
156
+ - lib/authlogic_connect/callback_filter.rb
157
+ - lib/authlogic_connect/common/session.rb
158
+ - lib/authlogic_connect/common/state.rb
159
+ - lib/authlogic_connect/common/user.rb
160
+ - lib/authlogic_connect/common/variables.rb
161
+ - lib/authlogic_connect/common.rb
162
+ - lib/authlogic_connect/engine.rb
163
+ - lib/authlogic_connect/ext.rb
164
+ - lib/authlogic_connect/oauth/helper.rb
165
+ - lib/authlogic_connect/oauth/process.rb
166
+ - lib/authlogic_connect/oauth/session.rb
167
+ - lib/authlogic_connect/oauth/state.rb
168
+ - lib/authlogic_connect/oauth/tokens/aol_token.rb
169
+ - lib/authlogic_connect/oauth/tokens/facebook_token.rb
170
+ - lib/authlogic_connect/oauth/tokens/get_satisfaction_token.rb
171
+ - lib/authlogic_connect/oauth/tokens/google_token.rb
172
+ - lib/authlogic_connect/oauth/tokens/linked_in_token.rb
173
+ - lib/authlogic_connect/oauth/tokens/meetup_token.rb
174
+ - lib/authlogic_connect/oauth/tokens/myspace_token.rb
175
+ - lib/authlogic_connect/oauth/tokens/netflix_token.rb
176
+ - lib/authlogic_connect/oauth/tokens/oauth_token.rb
177
+ - lib/authlogic_connect/oauth/tokens/oauth_token.rb~
178
+ - lib/authlogic_connect/oauth/tokens/ohloh_token.rb
179
+ - lib/authlogic_connect/oauth/tokens/opensocial_token.rb
180
+ - lib/authlogic_connect/oauth/tokens/twitter_token.rb
181
+ - lib/authlogic_connect/oauth/tokens/vimeo_token.rb
182
+ - lib/authlogic_connect/oauth/tokens/yahoo_token.rb
183
+ - lib/authlogic_connect/oauth/user.rb
184
+ - lib/authlogic_connect/oauth/variables.rb
185
+ - lib/authlogic_connect/oauth.rb
186
+ - lib/authlogic_connect/openid/process.rb
187
+ - lib/authlogic_connect/openid/session.rb
188
+ - lib/authlogic_connect/openid/state.rb
189
+ - lib/authlogic_connect/openid/tokens/aol_token.rb
190
+ - lib/authlogic_connect/openid/tokens/blogger_token.rb
191
+ - lib/authlogic_connect/openid/tokens/flickr_token.rb
192
+ - lib/authlogic_connect/openid/tokens/my_openid_token.rb
193
+ - lib/authlogic_connect/openid/tokens/openid_token.rb
194
+ - lib/authlogic_connect/openid/user.rb
195
+ - lib/authlogic_connect/openid/variables.rb
196
+ - lib/authlogic_connect/openid.rb
197
+ - lib/open_id_authentication.rb
198
+ - rails/init.rb
199
+ - test/controllers/test_users_controller.rb
200
+ - test/libs/database.rb
201
+ - test/libs/user.rb
202
+ - test/libs/user_session.rb
203
+ - test/old.rb
204
+ - test/test_authlogic_connect.rb
205
+ - test/test_helper.rb
206
+ - test/test_user.rb
207
+ has_rdoc: true
208
+ homepage: http://github.com/andrewacove/authlogic-connect
209
+ licenses: []
210
+
211
+ post_install_message:
212
+ rdoc_options: []
213
+
214
+ require_paths:
215
+ - lib
216
+ required_ruby_version: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ hash: 3
222
+ segments:
223
+ - 0
224
+ version: "0"
225
+ required_rubygems_version: !ruby/object:Gem::Requirement
226
+ none: false
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ hash: 3
231
+ segments:
232
+ - 0
233
+ version: "0"
234
+ requirements: []
235
+
236
+ rubyforge_project: authlogic-connect-x
237
+ rubygems_version: 1.3.7
238
+ signing_key:
239
+ specification_version: 3
240
+ summary: "Andrew Cove's local changes to Authlogic Connect: Oauth and OpenID made dead simple."
241
+ test_files: []
242
+