authlogic-connect 0.0.3.9 → 0.0.4.03
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.
- data/README.markdown +9 -5
- data/Rakefile +7 -3
- data/lib/authlogic-connect.rb +2 -2
- data/lib/authlogic_connect/{token.rb → access_token.rb} +1 -1
- data/lib/authlogic_connect/authlogic_connect.rb +0 -0
- data/lib/authlogic_connect/common/session.rb +13 -10
- data/lib/authlogic_connect/common/state.rb +21 -5
- data/lib/authlogic_connect/common/user.rb +27 -65
- data/lib/authlogic_connect/common/variables.rb +75 -11
- data/lib/authlogic_connect/oauth/helper.rb +0 -0
- data/lib/authlogic_connect/oauth/process.rb +19 -12
- data/lib/authlogic_connect/oauth/session.rb +15 -11
- data/lib/authlogic_connect/oauth/state.rb +19 -13
- data/lib/authlogic_connect/oauth/tokens/aol_token.rb +2 -0
- data/lib/authlogic_connect/oauth/tokens/google_token.rb +11 -11
- data/lib/authlogic_connect/oauth/tokens/meetup_token.rb +12 -0
- data/lib/authlogic_connect/oauth/tokens/netflix_token.rb +10 -0
- data/lib/authlogic_connect/oauth/tokens/oauth_token.rb +6 -2
- data/lib/authlogic_connect/oauth/tokens/ohloh_token.rb +9 -0
- data/lib/authlogic_connect/oauth/user.rb +9 -14
- data/lib/authlogic_connect/oauth/variables.rb +9 -0
- data/lib/authlogic_connect/openid/process.rb +49 -5
- data/lib/authlogic_connect/openid/session.rb +13 -34
- data/lib/authlogic_connect/openid/state.rb +45 -44
- data/lib/authlogic_connect/openid/tokens/openid_token.rb +1 -1
- data/lib/authlogic_connect/openid/user.rb +5 -29
- data/lib/authlogic_connect/openid/variables.rb +2 -2
- data/lib/open_id_authentication.rb +0 -1
- data/test/controllers/test_users_controller.rb +0 -0
- data/test/libs/database.rb +0 -0
- data/test/libs/user.rb +6 -2
- data/test/libs/user_session.rb +0 -0
- data/test/test_helper.rb +1 -1
- data/test/test_user.rb +5 -66
- metadata +10 -6
@@ -21,33 +21,6 @@ module AuthlogicConnect::Openid
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def authenticate_with_openid
|
25
|
-
@openid_error = nil
|
26
|
-
if !openid_response?
|
27
|
-
save_openid_session
|
28
|
-
else
|
29
|
-
restore_attributes
|
30
|
-
end
|
31
|
-
options = {}
|
32
|
-
options[:return_to] = auth_callback_url(:for_model => "1", :action => "create")
|
33
|
-
auth_controller.send(:authenticate_with_open_id, openid_identifier, options) do |result, openid_identifier|
|
34
|
-
create_openid_token(result, openid_identifier)
|
35
|
-
return true
|
36
|
-
end
|
37
|
-
return false
|
38
|
-
end
|
39
|
-
|
40
|
-
def create_openid_token(result, openid_identifier)
|
41
|
-
if result.unsuccessful?
|
42
|
-
@openid_error = result.message
|
43
|
-
elsif Token.find_by_key(openid_identifier.normalize_identifier)
|
44
|
-
else
|
45
|
-
token = OpenidToken.new(:key => openid_identifier)
|
46
|
-
self.tokens << token
|
47
|
-
self.active_token = token
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
24
|
def attributes_to_save
|
52
25
|
attr_list = [:id, :password, crypted_password_field, password_salt_field, :persistence_token, :perishable_token, :single_access_token, :login_count,
|
53
26
|
:failed_login_count, :last_request_at, :current_login_at, :last_login_at, :current_login_ip, :last_login_ip, :created_at,
|
@@ -55,8 +28,11 @@ module AuthlogicConnect::Openid
|
|
55
28
|
attrs_to_save = attributes.clone.delete_if do |k, v|
|
56
29
|
attr_list.include?(k.to_sym)
|
57
30
|
end
|
58
|
-
|
31
|
+
if self.respond_to?(:password) && self.respond_to?(:password_confirmation)
|
32
|
+
attrs_to_save.merge!(:password => password, :password_confirmation => password_confirmation)
|
33
|
+
end
|
34
|
+
attrs_to_save
|
59
35
|
end
|
60
36
|
end
|
61
37
|
end
|
62
|
-
end
|
38
|
+
end
|
@@ -9,11 +9,11 @@ module AuthlogicConnect::Openid::Variables
|
|
9
9
|
# end
|
10
10
|
|
11
11
|
def openid_identifier
|
12
|
-
auth_params[:openid_identifier]
|
12
|
+
auth_params[:openid_identifier] if auth_params?
|
13
13
|
end
|
14
14
|
|
15
15
|
def openid_provider
|
16
|
-
from_session_or_params(:openid_provider)
|
16
|
+
from_session_or_params(:openid_provider) if auth_controller?
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
@@ -108,7 +108,6 @@ module OpenIdAuthentication
|
|
108
108
|
def complete_open_id_authentication
|
109
109
|
response = request.env[Rack::OpenID::RESPONSE]
|
110
110
|
identifier = response.display_identifier
|
111
|
-
|
112
111
|
case response.status
|
113
112
|
when OpenID::Consumer::SUCCESS
|
114
113
|
yield Result[:successful], identifier,
|
File without changes
|
data/test/libs/database.rb
CHANGED
File without changes
|
data/test/libs/user.rb
CHANGED
data/test/libs/user_session.rb
CHANGED
File without changes
|
data/test/test_helper.rb
CHANGED
data/test/test_user.rb
CHANGED
@@ -13,9 +13,9 @@ module AuthlogicConnect
|
|
13
13
|
|
14
14
|
context "responds to added oauth methods (our oauth api on the user)" do
|
15
15
|
|
16
|
-
should "have '
|
17
|
-
assert @user.respond_to?(:
|
18
|
-
assert_equal [], @user.
|
16
|
+
should "have 'access_tokens' method" do
|
17
|
+
assert @user.respond_to?(:access_tokens)
|
18
|
+
assert_equal [], @user.access_tokens
|
19
19
|
end
|
20
20
|
|
21
21
|
should "have 'active_token' method" do
|
@@ -51,8 +51,8 @@ module AuthlogicConnect
|
|
51
51
|
@save_success = @user.save
|
52
52
|
end
|
53
53
|
|
54
|
-
should "
|
55
|
-
|
54
|
+
should "be a valid save" do
|
55
|
+
assert @save_success
|
56
56
|
end
|
57
57
|
|
58
58
|
should "not be using oauth" do
|
@@ -123,67 +123,6 @@ module AuthlogicConnect
|
|
123
123
|
assert @user.authenticating_with_oauth?
|
124
124
|
end
|
125
125
|
|
126
|
-
context "and 'save_with_oauth', manually checking each step" do
|
127
|
-
|
128
|
-
setup do
|
129
|
-
# mock save
|
130
|
-
# this, and the whole redirect process happens
|
131
|
-
# but we'll just assume we saved the session data and got the redirect back
|
132
|
-
@user.save_oauth_session
|
133
|
-
@user.save(:skip_redirect => true, :keep_session => true) do
|
134
|
-
"I'm the block you want"
|
135
|
-
end
|
136
|
-
# copy to test controller
|
137
|
-
@user.auth_session.each do |key, value|
|
138
|
-
@user.auth_controller.session[key] = value
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
should "should have a full session" do
|
143
|
-
@session_vars.each {|key| assert @user.auth_session.has_key?(key)}
|
144
|
-
end
|
145
|
-
|
146
|
-
should "'cleanup_auth_session'" do
|
147
|
-
@user.cleanup_auth_session
|
148
|
-
@session_vars.each {|key| assert_equal false, @user.auth_session.has_key?(key)}
|
149
|
-
end
|
150
|
-
|
151
|
-
teardown do
|
152
|
-
@user.destroy
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
context "and 'save_with_oauth' completely" do
|
158
|
-
setup do
|
159
|
-
# mock save
|
160
|
-
# this, and the whole redirect process happens
|
161
|
-
# but we'll just assume we saved the session data and got the redirect back
|
162
|
-
@user.save_oauth_session
|
163
|
-
@user.save(:skip_redirect => true, :keep_session => false) do
|
164
|
-
"I'm the block you want"
|
165
|
-
end
|
166
|
-
# copy to test controller
|
167
|
-
@user.auth_controller.session = @user.auth_session
|
168
|
-
end
|
169
|
-
|
170
|
-
should "have a clear session" do
|
171
|
-
@session_vars.each do |key|
|
172
|
-
assert_equal false, @user.auth_session.has_key?(key)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
should "be a valid save" do
|
177
|
-
assert @user.valid?
|
178
|
-
end
|
179
|
-
|
180
|
-
# so login isn't saved
|
181
|
-
teardown do
|
182
|
-
User.all.collect(&:destroy)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
|
187
126
|
end
|
188
127
|
|
189
128
|
context "with openid parameters" do
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
+
- 4
|
8
9
|
- 3
|
9
|
-
|
10
|
-
version: 0.0.3.9
|
10
|
+
version: 0.0.4.03
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lance Pollard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-31 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: "0"
|
121
121
|
type: :runtime
|
122
122
|
version_requirements: *id008
|
123
|
-
description:
|
123
|
+
description: Oauth and OpenID made dead simple
|
124
124
|
email: lancejpollard@gmail.com
|
125
125
|
executables: []
|
126
126
|
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- init.rb
|
135
135
|
- MIT-LICENSE
|
136
136
|
- lib/authlogic-connect.rb
|
137
|
+
- lib/authlogic_connect/access_token.rb
|
137
138
|
- lib/authlogic_connect/authlogic_connect.rb
|
138
139
|
- lib/authlogic_connect/callback_filter.rb
|
139
140
|
- lib/authlogic_connect/common/session.rb
|
@@ -147,12 +148,16 @@ files:
|
|
147
148
|
- lib/authlogic_connect/oauth/process.rb
|
148
149
|
- lib/authlogic_connect/oauth/session.rb
|
149
150
|
- lib/authlogic_connect/oauth/state.rb
|
151
|
+
- lib/authlogic_connect/oauth/tokens/aol_token.rb
|
150
152
|
- lib/authlogic_connect/oauth/tokens/facebook_token.rb
|
151
153
|
- lib/authlogic_connect/oauth/tokens/get_satisfaction_token.rb
|
152
154
|
- lib/authlogic_connect/oauth/tokens/google_token.rb
|
153
155
|
- lib/authlogic_connect/oauth/tokens/linked_in_token.rb
|
156
|
+
- lib/authlogic_connect/oauth/tokens/meetup_token.rb
|
154
157
|
- lib/authlogic_connect/oauth/tokens/myspace_token.rb
|
158
|
+
- lib/authlogic_connect/oauth/tokens/netflix_token.rb
|
155
159
|
- lib/authlogic_connect/oauth/tokens/oauth_token.rb
|
160
|
+
- lib/authlogic_connect/oauth/tokens/ohloh_token.rb
|
156
161
|
- lib/authlogic_connect/oauth/tokens/opensocial_token.rb
|
157
162
|
- lib/authlogic_connect/oauth/tokens/twitter_token.rb
|
158
163
|
- lib/authlogic_connect/oauth/tokens/vimeo_token.rb
|
@@ -171,7 +176,6 @@ files:
|
|
171
176
|
- lib/authlogic_connect/openid/user.rb
|
172
177
|
- lib/authlogic_connect/openid/variables.rb
|
173
178
|
- lib/authlogic_connect/openid.rb
|
174
|
-
- lib/authlogic_connect/token.rb
|
175
179
|
- lib/open_id_authentication.rb
|
176
180
|
- rails/init.rb
|
177
181
|
- test/controllers/test_users_controller.rb
|
@@ -212,6 +216,6 @@ rubyforge_project: authlogic-connect
|
|
212
216
|
rubygems_version: 1.3.6
|
213
217
|
signing_key:
|
214
218
|
specification_version: 3
|
215
|
-
summary: "Authlogic Connect:
|
219
|
+
summary: "Authlogic Connect: Oauth and OpenID made dead simple"
|
216
220
|
test_files: []
|
217
221
|
|