authlogic 2.0.1 → 2.1.2
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/.gitignore +9 -0
- data/CHANGELOG.rdoc +110 -1
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.rdoc +138 -161
- data/Rakefile +40 -19
- data/VERSION.yml +4 -0
- data/authlogic.gemspec +212 -0
- data/init.rb +1 -1
- data/lib/authlogic/acts_as_authentic/base.rb +44 -35
- data/lib/authlogic/acts_as_authentic/email.rb +47 -14
- data/lib/authlogic/acts_as_authentic/logged_in_status.rb +20 -14
- data/lib/authlogic/acts_as_authentic/login.rb +84 -8
- data/lib/authlogic/acts_as_authentic/password.rb +207 -88
- data/lib/authlogic/acts_as_authentic/perishable_token.rb +9 -4
- data/lib/authlogic/acts_as_authentic/persistence_token.rb +4 -2
- data/lib/authlogic/acts_as_authentic/restful_authentication.rb +5 -4
- data/lib/authlogic/acts_as_authentic/session_maintenance.rb +16 -4
- data/lib/authlogic/acts_as_authentic/single_access_token.rb +10 -3
- data/lib/authlogic/acts_as_authentic/validations_scope.rb +1 -1
- data/lib/authlogic/controller_adapters/abstract_adapter.rb +13 -1
- data/lib/authlogic/controller_adapters/rails_adapter.rb +14 -4
- data/lib/authlogic/controller_adapters/sinatra_adapter.rb +61 -0
- data/lib/authlogic/crypto_providers/aes256.rb +2 -2
- data/lib/authlogic/crypto_providers/bcrypt.rb +3 -1
- data/lib/authlogic/crypto_providers/sha1.rb +2 -2
- data/lib/authlogic/i18n/translator.rb +15 -0
- data/lib/authlogic/i18n.rb +43 -14
- data/lib/authlogic/regex.rb +25 -0
- data/lib/authlogic/session/activation.rb +2 -0
- data/lib/authlogic/session/active_record_trickery.rb +26 -5
- data/lib/authlogic/session/brute_force_protection.rb +30 -11
- data/lib/authlogic/session/callbacks.rb +18 -7
- data/lib/authlogic/session/cookies.rb +21 -17
- data/lib/authlogic/session/existence.rb +6 -2
- data/lib/authlogic/session/foundation.rb +1 -1
- data/lib/authlogic/session/http_auth.rb +46 -11
- data/lib/authlogic/session/magic_columns.rb +29 -9
- data/lib/authlogic/session/magic_states.rb +6 -5
- data/lib/authlogic/session/params.rb +16 -10
- data/lib/authlogic/session/password.rb +115 -31
- data/lib/authlogic/session/priority_record.rb +1 -1
- data/lib/authlogic/session/session.rb +5 -3
- data/lib/authlogic/session/timeout.rb +1 -1
- data/lib/authlogic/session/validation.rb +13 -7
- data/lib/authlogic/test_case/mock_controller.rb +45 -0
- data/lib/authlogic/test_case/mock_cookie_jar.rb +14 -0
- data/lib/authlogic/test_case/mock_logger.rb +10 -0
- data/lib/authlogic/test_case/mock_request.rb +19 -0
- data/lib/authlogic/test_case/rails_request_adapter.rb +30 -0
- data/lib/authlogic/test_case.rb +114 -0
- data/lib/authlogic.rb +4 -3
- data/rails/init.rb +1 -0
- data/shoulda_macros/authlogic.rb +3 -2
- data/test/acts_as_authentic_test/base_test.rb +6 -0
- data/test/acts_as_authentic_test/email_test.rb +25 -7
- data/test/acts_as_authentic_test/login_test.rb +37 -7
- data/test/acts_as_authentic_test/magic_columns_test.rb +4 -4
- data/test/acts_as_authentic_test/password_test.rb +46 -44
- data/test/acts_as_authentic_test/perishable_token_test.rb +36 -2
- data/test/acts_as_authentic_test/restful_authentication_test.rb +40 -0
- data/test/acts_as_authentic_test/session_maintenance_test.rb +26 -18
- data/test/acts_as_authentic_test/single_access_test.rb +6 -1
- data/test/i18n_test.rb +33 -0
- data/test/libs/affiliate.rb +7 -0
- data/test/libs/ldaper.rb +3 -0
- data/test/random_test.rb +2 -2
- data/test/session_test/activation_test.rb +1 -1
- data/test/session_test/active_record_trickery_test.rb +12 -2
- data/test/session_test/brute_force_protection_test.rb +37 -12
- data/test/session_test/cookies_test.rb +3 -3
- data/test/session_test/existence_test.rb +3 -3
- data/test/session_test/http_auth_test.rb +20 -8
- data/test/session_test/magic_columns_test.rb +9 -6
- data/test/session_test/magic_states_test.rb +3 -3
- data/test/session_test/params_test.rb +4 -4
- data/test/session_test/password_test.rb +23 -1
- data/test/session_test/session_test.rb +9 -9
- data/test/session_test/timeout_test.rb +10 -1
- data/test/test_helper.rb +53 -23
- metadata +42 -27
- data/Manifest.txt +0 -111
- data/lib/authlogic/testing/test_unit_helpers.rb +0 -39
- data/lib/authlogic/version.rb +0 -56
- data/test/libs/mock_controller.rb +0 -35
- data/test/libs/mock_cookie_jar.rb +0 -10
- data/test/libs/mock_request.rb +0 -5
data/test/test_helper.rb
CHANGED
|
@@ -2,10 +2,28 @@ require "test/unit"
|
|
|
2
2
|
require "rubygems"
|
|
3
3
|
require "ruby-debug"
|
|
4
4
|
require "active_record"
|
|
5
|
-
require
|
|
5
|
+
require "active_record/fixtures"
|
|
6
|
+
|
|
7
|
+
# A temporary fix to bring active record errors up to speed with rails edge.
|
|
8
|
+
# I need to remove this once the new gem is released. This is only here so my tests pass.
|
|
9
|
+
unless defined?(::ActiveModel)
|
|
10
|
+
class ActiveRecord::Errors
|
|
11
|
+
def [](key)
|
|
12
|
+
value = on(key)
|
|
13
|
+
value.is_a?(Array) ? value : [value].compact
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
6
18
|
|
|
7
19
|
ActiveRecord::Schema.verbose = false
|
|
8
|
-
|
|
20
|
+
|
|
21
|
+
begin
|
|
22
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
|
23
|
+
rescue ArgumentError
|
|
24
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
|
25
|
+
end
|
|
26
|
+
|
|
9
27
|
ActiveRecord::Base.configurations = true
|
|
10
28
|
ActiveRecord::Schema.define(:version => 1) do
|
|
11
29
|
create_table :companies do |t|
|
|
@@ -69,15 +87,32 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
|
69
87
|
t.string :current_login_ip
|
|
70
88
|
t.string :last_login_ip
|
|
71
89
|
end
|
|
90
|
+
|
|
91
|
+
create_table :affiliates do |t|
|
|
92
|
+
t.datetime :created_at
|
|
93
|
+
t.datetime :updated_at
|
|
94
|
+
t.integer :company_id
|
|
95
|
+
t.string :username
|
|
96
|
+
t.string :pw_hash
|
|
97
|
+
t.string :pw_salt
|
|
98
|
+
t.string :persistence_token
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
create_table :ldapers do |t|
|
|
102
|
+
t.datetime :created_at
|
|
103
|
+
t.datetime :updated_at
|
|
104
|
+
t.string :ldap_login
|
|
105
|
+
t.string :persistence_token
|
|
106
|
+
end
|
|
72
107
|
end
|
|
73
108
|
|
|
74
109
|
require File.dirname(__FILE__) + '/../lib/authlogic' unless defined?(Authlogic)
|
|
75
|
-
require File.dirname(__FILE__) + '/
|
|
76
|
-
require File.dirname(__FILE__) + '/libs/mock_cookie_jar'
|
|
77
|
-
require File.dirname(__FILE__) + '/libs/mock_controller'
|
|
110
|
+
require File.dirname(__FILE__) + '/../lib/authlogic/test_case'
|
|
78
111
|
require File.dirname(__FILE__) + '/libs/project'
|
|
112
|
+
require File.dirname(__FILE__) + '/libs/affiliate'
|
|
79
113
|
require File.dirname(__FILE__) + '/libs/employee'
|
|
80
114
|
require File.dirname(__FILE__) + '/libs/employee_session'
|
|
115
|
+
require File.dirname(__FILE__) + '/libs/ldaper'
|
|
81
116
|
require File.dirname(__FILE__) + '/libs/user'
|
|
82
117
|
require File.dirname(__FILE__) + '/libs/user_session'
|
|
83
118
|
require File.dirname(__FILE__) + '/libs/company'
|
|
@@ -94,11 +129,6 @@ class ActiveSupport::TestCase
|
|
|
94
129
|
setup :activate_authlogic
|
|
95
130
|
|
|
96
131
|
private
|
|
97
|
-
def activate_authlogic
|
|
98
|
-
@controller = MockController.new
|
|
99
|
-
Authlogic::Session::Base.controller = @controller
|
|
100
|
-
end
|
|
101
|
-
|
|
102
132
|
def password_for(user)
|
|
103
133
|
case user
|
|
104
134
|
when users(:ben)
|
|
@@ -110,43 +140,43 @@ class ActiveSupport::TestCase
|
|
|
110
140
|
|
|
111
141
|
def http_basic_auth_for(user = nil, &block)
|
|
112
142
|
unless user.blank?
|
|
113
|
-
|
|
114
|
-
|
|
143
|
+
controller.http_user = user.login
|
|
144
|
+
controller.http_password = password_for(user)
|
|
115
145
|
end
|
|
116
146
|
yield
|
|
117
|
-
|
|
147
|
+
controller.http_user = controller.http_password = nil
|
|
118
148
|
end
|
|
119
149
|
|
|
120
150
|
def set_cookie_for(user, id = nil)
|
|
121
|
-
|
|
151
|
+
controller.cookies["user_credentials"] = {:value => user.persistence_token, :expires => nil}
|
|
122
152
|
end
|
|
123
153
|
|
|
124
154
|
def unset_cookie
|
|
125
|
-
|
|
155
|
+
controller.cookies["user_credentials"] = nil
|
|
126
156
|
end
|
|
127
157
|
|
|
128
158
|
def set_params_for(user, id = nil)
|
|
129
|
-
|
|
159
|
+
controller.params["user_credentials"] = user.single_access_token
|
|
130
160
|
end
|
|
131
161
|
|
|
132
162
|
def unset_params
|
|
133
|
-
|
|
163
|
+
controller.params["user_credentials"] = nil
|
|
134
164
|
end
|
|
135
165
|
|
|
136
166
|
def set_request_content_type(type)
|
|
137
|
-
|
|
167
|
+
controller.request_content_type = type
|
|
138
168
|
end
|
|
139
169
|
|
|
140
170
|
def unset_request_content_type
|
|
141
|
-
|
|
171
|
+
controller.request_content_type = nil
|
|
142
172
|
end
|
|
143
173
|
|
|
144
174
|
def set_session_for(user, id = nil)
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
controller.session["user_credentials"] = user.persistence_token
|
|
176
|
+
controller.session["user_credentials_id"] = user.id
|
|
147
177
|
end
|
|
148
178
|
|
|
149
179
|
def unset_session
|
|
150
|
-
|
|
180
|
+
controller.session["user_credentials"] = controller.session["user_credentials_id"] = nil
|
|
151
181
|
end
|
|
152
|
-
end
|
|
182
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authlogic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Johnson of Binary Logic
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-09-12 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -22,32 +22,23 @@ dependencies:
|
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
23
|
version: "0"
|
|
24
24
|
version:
|
|
25
|
-
|
|
26
|
-
name: hoe
|
|
27
|
-
type: :development
|
|
28
|
-
version_requirement:
|
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 1.11.0
|
|
34
|
-
version:
|
|
35
|
-
description: A clean, simple, and unobtrusive ruby authentication solution.
|
|
25
|
+
description:
|
|
36
26
|
email: bjohnson@binarylogic.com
|
|
37
27
|
executables: []
|
|
38
28
|
|
|
39
29
|
extensions: []
|
|
40
30
|
|
|
41
31
|
extra_rdoc_files:
|
|
42
|
-
-
|
|
43
|
-
- CHANGELOG.rdoc
|
|
32
|
+
- LICENSE
|
|
44
33
|
- README.rdoc
|
|
45
34
|
files:
|
|
35
|
+
- .gitignore
|
|
46
36
|
- CHANGELOG.rdoc
|
|
47
|
-
-
|
|
48
|
-
- Manifest.txt
|
|
37
|
+
- LICENSE
|
|
49
38
|
- README.rdoc
|
|
50
39
|
- Rakefile
|
|
40
|
+
- VERSION.yml
|
|
41
|
+
- authlogic.gemspec
|
|
51
42
|
- generators/session/session_generator.rb
|
|
52
43
|
- generators/session/templates/session.rb
|
|
53
44
|
- init.rb
|
|
@@ -69,13 +60,16 @@ files:
|
|
|
69
60
|
- lib/authlogic/controller_adapters/abstract_adapter.rb
|
|
70
61
|
- lib/authlogic/controller_adapters/merb_adapter.rb
|
|
71
62
|
- lib/authlogic/controller_adapters/rails_adapter.rb
|
|
63
|
+
- lib/authlogic/controller_adapters/sinatra_adapter.rb
|
|
72
64
|
- lib/authlogic/crypto_providers/aes256.rb
|
|
73
65
|
- lib/authlogic/crypto_providers/bcrypt.rb
|
|
74
66
|
- lib/authlogic/crypto_providers/md5.rb
|
|
75
67
|
- lib/authlogic/crypto_providers/sha1.rb
|
|
76
68
|
- lib/authlogic/crypto_providers/sha512.rb
|
|
77
69
|
- lib/authlogic/i18n.rb
|
|
70
|
+
- lib/authlogic/i18n/translator.rb
|
|
78
71
|
- lib/authlogic/random.rb
|
|
72
|
+
- lib/authlogic/regex.rb
|
|
79
73
|
- lib/authlogic/session/activation.rb
|
|
80
74
|
- lib/authlogic/session/active_record_trickery.rb
|
|
81
75
|
- lib/authlogic/session/base.rb
|
|
@@ -99,8 +93,13 @@ files:
|
|
|
99
93
|
- lib/authlogic/session/timeout.rb
|
|
100
94
|
- lib/authlogic/session/unauthorized_record.rb
|
|
101
95
|
- lib/authlogic/session/validation.rb
|
|
102
|
-
- lib/authlogic/
|
|
103
|
-
- lib/authlogic/
|
|
96
|
+
- lib/authlogic/test_case.rb
|
|
97
|
+
- lib/authlogic/test_case/mock_controller.rb
|
|
98
|
+
- lib/authlogic/test_case/mock_cookie_jar.rb
|
|
99
|
+
- lib/authlogic/test_case/mock_logger.rb
|
|
100
|
+
- lib/authlogic/test_case/mock_request.rb
|
|
101
|
+
- lib/authlogic/test_case/rails_request_adapter.rb
|
|
102
|
+
- rails/init.rb
|
|
104
103
|
- shoulda_macros/authlogic.rb
|
|
105
104
|
- test/acts_as_authentic_test/base_test.rb
|
|
106
105
|
- test/acts_as_authentic_test/email_test.rb
|
|
@@ -110,6 +109,7 @@ files:
|
|
|
110
109
|
- test/acts_as_authentic_test/password_test.rb
|
|
111
110
|
- test/acts_as_authentic_test/perishable_token_test.rb
|
|
112
111
|
- test/acts_as_authentic_test/persistence_token_test.rb
|
|
112
|
+
- test/acts_as_authentic_test/restful_authentication_test.rb
|
|
113
113
|
- test/acts_as_authentic_test/session_maintenance_test.rb
|
|
114
114
|
- test/acts_as_authentic_test/single_access_test.rb
|
|
115
115
|
- test/authenticates_many_test.rb
|
|
@@ -121,12 +121,12 @@ files:
|
|
|
121
121
|
- test/fixtures/employees.yml
|
|
122
122
|
- test/fixtures/projects.yml
|
|
123
123
|
- test/fixtures/users.yml
|
|
124
|
+
- test/i18n_test.rb
|
|
125
|
+
- test/libs/affiliate.rb
|
|
124
126
|
- test/libs/company.rb
|
|
125
127
|
- test/libs/employee.rb
|
|
126
128
|
- test/libs/employee_session.rb
|
|
127
|
-
- test/libs/
|
|
128
|
-
- test/libs/mock_cookie_jar.rb
|
|
129
|
-
- test/libs/mock_request.rb
|
|
129
|
+
- test/libs/ldaper.rb
|
|
130
130
|
- test/libs/ordered_hash.rb
|
|
131
131
|
- test/libs/project.rb
|
|
132
132
|
- test/libs/user.rb
|
|
@@ -156,10 +156,11 @@ files:
|
|
|
156
156
|
- test/test_helper.rb
|
|
157
157
|
has_rdoc: true
|
|
158
158
|
homepage: http://github.com/binarylogic/authlogic
|
|
159
|
-
|
|
159
|
+
licenses: []
|
|
160
|
+
|
|
161
|
+
post_install_message:
|
|
160
162
|
rdoc_options:
|
|
161
|
-
- --
|
|
162
|
-
- README.rdoc
|
|
163
|
+
- --charset=UTF-8
|
|
163
164
|
require_paths:
|
|
164
165
|
- lib
|
|
165
166
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -177,9 +178,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
177
178
|
requirements: []
|
|
178
179
|
|
|
179
180
|
rubyforge_project: authlogic
|
|
180
|
-
rubygems_version: 1.3.
|
|
181
|
+
rubygems_version: 1.3.5
|
|
181
182
|
signing_key:
|
|
182
|
-
specification_version:
|
|
183
|
+
specification_version: 3
|
|
183
184
|
summary: A clean, simple, and unobtrusive ruby authentication solution.
|
|
184
185
|
test_files:
|
|
185
186
|
- test/acts_as_authentic_test/base_test.rb
|
|
@@ -190,12 +191,25 @@ test_files:
|
|
|
190
191
|
- test/acts_as_authentic_test/password_test.rb
|
|
191
192
|
- test/acts_as_authentic_test/perishable_token_test.rb
|
|
192
193
|
- test/acts_as_authentic_test/persistence_token_test.rb
|
|
194
|
+
- test/acts_as_authentic_test/restful_authentication_test.rb
|
|
193
195
|
- test/acts_as_authentic_test/session_maintenance_test.rb
|
|
194
196
|
- test/acts_as_authentic_test/single_access_test.rb
|
|
197
|
+
- test/authenticates_many_test.rb
|
|
195
198
|
- test/crypto_provider_test/aes256_test.rb
|
|
196
199
|
- test/crypto_provider_test/bcrypt_test.rb
|
|
197
200
|
- test/crypto_provider_test/sha1_test.rb
|
|
198
201
|
- test/crypto_provider_test/sha512_test.rb
|
|
202
|
+
- test/i18n_test.rb
|
|
203
|
+
- test/libs/affiliate.rb
|
|
204
|
+
- test/libs/company.rb
|
|
205
|
+
- test/libs/employee.rb
|
|
206
|
+
- test/libs/employee_session.rb
|
|
207
|
+
- test/libs/ldaper.rb
|
|
208
|
+
- test/libs/ordered_hash.rb
|
|
209
|
+
- test/libs/project.rb
|
|
210
|
+
- test/libs/user.rb
|
|
211
|
+
- test/libs/user_session.rb
|
|
212
|
+
- test/random_test.rb
|
|
199
213
|
- test/session_test/activation_test.rb
|
|
200
214
|
- test/session_test/active_record_trickery_test.rb
|
|
201
215
|
- test/session_test/brute_force_protection_test.rb
|
|
@@ -217,3 +231,4 @@ test_files:
|
|
|
217
231
|
- test/session_test/timeout_test.rb
|
|
218
232
|
- test/session_test/unauthorized_record_test.rb
|
|
219
233
|
- test/session_test/validation_test.rb
|
|
234
|
+
- test/test_helper.rb
|
data/Manifest.txt
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
CHANGELOG.rdoc
|
|
2
|
-
MIT-LICENSE
|
|
3
|
-
Manifest.txt
|
|
4
|
-
README.rdoc
|
|
5
|
-
Rakefile
|
|
6
|
-
generators/session/session_generator.rb
|
|
7
|
-
generators/session/templates/session.rb
|
|
8
|
-
init.rb
|
|
9
|
-
lib/authlogic.rb
|
|
10
|
-
lib/authlogic/acts_as_authentic/base.rb
|
|
11
|
-
lib/authlogic/acts_as_authentic/email.rb
|
|
12
|
-
lib/authlogic/acts_as_authentic/logged_in_status.rb
|
|
13
|
-
lib/authlogic/acts_as_authentic/login.rb
|
|
14
|
-
lib/authlogic/acts_as_authentic/magic_columns.rb
|
|
15
|
-
lib/authlogic/acts_as_authentic/password.rb
|
|
16
|
-
lib/authlogic/acts_as_authentic/perishable_token.rb
|
|
17
|
-
lib/authlogic/acts_as_authentic/persistence_token.rb
|
|
18
|
-
lib/authlogic/acts_as_authentic/restful_authentication.rb
|
|
19
|
-
lib/authlogic/acts_as_authentic/session_maintenance.rb
|
|
20
|
-
lib/authlogic/acts_as_authentic/single_access_token.rb
|
|
21
|
-
lib/authlogic/acts_as_authentic/validations_scope.rb
|
|
22
|
-
lib/authlogic/authenticates_many/association.rb
|
|
23
|
-
lib/authlogic/authenticates_many/base.rb
|
|
24
|
-
lib/authlogic/controller_adapters/abstract_adapter.rb
|
|
25
|
-
lib/authlogic/controller_adapters/merb_adapter.rb
|
|
26
|
-
lib/authlogic/controller_adapters/rails_adapter.rb
|
|
27
|
-
lib/authlogic/crypto_providers/aes256.rb
|
|
28
|
-
lib/authlogic/crypto_providers/bcrypt.rb
|
|
29
|
-
lib/authlogic/crypto_providers/md5.rb
|
|
30
|
-
lib/authlogic/crypto_providers/sha1.rb
|
|
31
|
-
lib/authlogic/crypto_providers/sha512.rb
|
|
32
|
-
lib/authlogic/i18n.rb
|
|
33
|
-
lib/authlogic/random.rb
|
|
34
|
-
lib/authlogic/session/activation.rb
|
|
35
|
-
lib/authlogic/session/active_record_trickery.rb
|
|
36
|
-
lib/authlogic/session/base.rb
|
|
37
|
-
lib/authlogic/session/brute_force_protection.rb
|
|
38
|
-
lib/authlogic/session/callbacks.rb
|
|
39
|
-
lib/authlogic/session/cookies.rb
|
|
40
|
-
lib/authlogic/session/existence.rb
|
|
41
|
-
lib/authlogic/session/foundation.rb
|
|
42
|
-
lib/authlogic/session/http_auth.rb
|
|
43
|
-
lib/authlogic/session/id.rb
|
|
44
|
-
lib/authlogic/session/klass.rb
|
|
45
|
-
lib/authlogic/session/magic_columns.rb
|
|
46
|
-
lib/authlogic/session/magic_states.rb
|
|
47
|
-
lib/authlogic/session/params.rb
|
|
48
|
-
lib/authlogic/session/password.rb
|
|
49
|
-
lib/authlogic/session/perishable_token.rb
|
|
50
|
-
lib/authlogic/session/persistence.rb
|
|
51
|
-
lib/authlogic/session/priority_record.rb
|
|
52
|
-
lib/authlogic/session/scopes.rb
|
|
53
|
-
lib/authlogic/session/session.rb
|
|
54
|
-
lib/authlogic/session/timeout.rb
|
|
55
|
-
lib/authlogic/session/unauthorized_record.rb
|
|
56
|
-
lib/authlogic/session/validation.rb
|
|
57
|
-
lib/authlogic/testing/test_unit_helpers.rb
|
|
58
|
-
lib/authlogic/version.rb
|
|
59
|
-
shoulda_macros/authlogic.rb
|
|
60
|
-
test/acts_as_authentic_test/base_test.rb
|
|
61
|
-
test/acts_as_authentic_test/email_test.rb
|
|
62
|
-
test/acts_as_authentic_test/logged_in_status_test.rb
|
|
63
|
-
test/acts_as_authentic_test/login_test.rb
|
|
64
|
-
test/acts_as_authentic_test/magic_columns_test.rb
|
|
65
|
-
test/acts_as_authentic_test/password_test.rb
|
|
66
|
-
test/acts_as_authentic_test/perishable_token_test.rb
|
|
67
|
-
test/acts_as_authentic_test/persistence_token_test.rb
|
|
68
|
-
test/acts_as_authentic_test/session_maintenance_test.rb
|
|
69
|
-
test/acts_as_authentic_test/single_access_test.rb
|
|
70
|
-
test/authenticates_many_test.rb
|
|
71
|
-
test/crypto_provider_test/aes256_test.rb
|
|
72
|
-
test/crypto_provider_test/bcrypt_test.rb
|
|
73
|
-
test/crypto_provider_test/sha1_test.rb
|
|
74
|
-
test/crypto_provider_test/sha512_test.rb
|
|
75
|
-
test/fixtures/companies.yml
|
|
76
|
-
test/fixtures/employees.yml
|
|
77
|
-
test/fixtures/projects.yml
|
|
78
|
-
test/fixtures/users.yml
|
|
79
|
-
test/libs/company.rb
|
|
80
|
-
test/libs/employee.rb
|
|
81
|
-
test/libs/employee_session.rb
|
|
82
|
-
test/libs/mock_controller.rb
|
|
83
|
-
test/libs/mock_cookie_jar.rb
|
|
84
|
-
test/libs/mock_request.rb
|
|
85
|
-
test/libs/ordered_hash.rb
|
|
86
|
-
test/libs/project.rb
|
|
87
|
-
test/libs/user.rb
|
|
88
|
-
test/libs/user_session.rb
|
|
89
|
-
test/random_test.rb
|
|
90
|
-
test/session_test/activation_test.rb
|
|
91
|
-
test/session_test/active_record_trickery_test.rb
|
|
92
|
-
test/session_test/brute_force_protection_test.rb
|
|
93
|
-
test/session_test/callbacks_test.rb
|
|
94
|
-
test/session_test/cookies_test.rb
|
|
95
|
-
test/session_test/credentials_test.rb
|
|
96
|
-
test/session_test/existence_test.rb
|
|
97
|
-
test/session_test/http_auth_test.rb
|
|
98
|
-
test/session_test/id_test.rb
|
|
99
|
-
test/session_test/klass_test.rb
|
|
100
|
-
test/session_test/magic_columns_test.rb
|
|
101
|
-
test/session_test/magic_states_test.rb
|
|
102
|
-
test/session_test/params_test.rb
|
|
103
|
-
test/session_test/password_test.rb
|
|
104
|
-
test/session_test/perishability_test.rb
|
|
105
|
-
test/session_test/persistence_test.rb
|
|
106
|
-
test/session_test/scopes_test.rb
|
|
107
|
-
test/session_test/session_test.rb
|
|
108
|
-
test/session_test/timeout_test.rb
|
|
109
|
-
test/session_test/unauthorized_record_test.rb
|
|
110
|
-
test/session_test/validation_test.rb
|
|
111
|
-
test/test_helper.rb
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module Authlogic
|
|
2
|
-
# Various utilities to help with testing. Keep in mind, Authlogic is thoroughly tested for you, the only thing you should be
|
|
3
|
-
# testing is code you write, such as code in your controller.
|
|
4
|
-
module Testing
|
|
5
|
-
# Provides useful methods for testing in Test::Unit, lets you log records in, etc. Just include this in your test_helper filter:
|
|
6
|
-
#
|
|
7
|
-
# require "authlogic/testing/test_unit_helpers"
|
|
8
|
-
#
|
|
9
|
-
# Then you will have the methods below to use in your tests.
|
|
10
|
-
module TestUnitHelpers
|
|
11
|
-
private
|
|
12
|
-
def session_class(record) # :nodoc:
|
|
13
|
-
record.class.acts_as_authentic_config[:session_class].constantize
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Sets the session for a record. This way when you execute a request in your test, session values will be present.
|
|
17
|
-
def set_session_for(record)
|
|
18
|
-
session_class = session_class(record)
|
|
19
|
-
@request.session[session_class.session_key] = record.send(record.class.acts_as_authentic_config[:persistence_token_field])
|
|
20
|
-
@request.session["#{session_class.session_key}_id"] = record.id
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# Sets the cookie for a record. This way when you execute a request in your test, cookie values will be present.
|
|
24
|
-
def set_cookie_for(record)
|
|
25
|
-
session_class = session_class(record)
|
|
26
|
-
@request.cookies[session_class.cookie_key] = record.send(record.class.acts_as_authentic_config[:persistence_token_field])
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Sets the HTTP_AUTHORIZATION header for basic HTTP auth. This way when you execute a request in your test that is trying to authenticate
|
|
30
|
-
# with HTTP basic auth, the neccessary headers will be present.
|
|
31
|
-
def set_http_auth_for(username, password)
|
|
32
|
-
session_class = session_class(record)
|
|
33
|
-
@request.env['HTTP_AUTHORIZATION'] = @controller.encode_credentials(username, password)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
Test::Unit::TestCase.send(:include, Authlogic::Testing::TestUnitHelpers)
|
data/lib/authlogic/version.rb
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module Authlogic # :nodoc:
|
|
2
|
-
# = Version
|
|
3
|
-
#
|
|
4
|
-
# A class for describing the current version of a library. The version
|
|
5
|
-
# consists of three parts: the +major+ number, the +minor+ number, and the
|
|
6
|
-
# +tiny+ (or +patch+) number.
|
|
7
|
-
class Version
|
|
8
|
-
|
|
9
|
-
include Comparable
|
|
10
|
-
|
|
11
|
-
# A convenience method for instantiating a new Version instance with the
|
|
12
|
-
# given +major+, +minor+, and +tiny+ components.
|
|
13
|
-
def self.[](major, minor, tiny)
|
|
14
|
-
new(major, minor, tiny)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
attr_reader :major, :minor, :tiny
|
|
18
|
-
|
|
19
|
-
# Create a new Version object with the given components.
|
|
20
|
-
def initialize(major, minor, tiny)
|
|
21
|
-
@major, @minor, @tiny = major, minor, tiny
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Compare this version to the given +version+ object.
|
|
25
|
-
def <=>(version)
|
|
26
|
-
to_i <=> version.to_i
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Converts this version object to a string, where each of the three
|
|
30
|
-
# version components are joined by the '.' character. E.g., 2.0.0.
|
|
31
|
-
def to_s
|
|
32
|
-
@to_s ||= [@major, @minor, @tiny].join(".")
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Converts this version to a canonical integer that may be compared
|
|
36
|
-
# against other version objects.
|
|
37
|
-
def to_i
|
|
38
|
-
@to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def to_a
|
|
42
|
-
[@major, @minor, @tiny]
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
MAJOR = 2
|
|
46
|
-
MINOR = 0
|
|
47
|
-
TINY = 1
|
|
48
|
-
|
|
49
|
-
# The current version as a Version instance
|
|
50
|
-
CURRENT = new(MAJOR, MINOR, TINY)
|
|
51
|
-
# The current version as a String
|
|
52
|
-
STRING = CURRENT.to_s
|
|
53
|
-
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
class MockController < Authlogic::ControllerAdapters::AbstractAdapter
|
|
2
|
-
attr_accessor :http_user, :http_password
|
|
3
|
-
attr_writer :request_content_type
|
|
4
|
-
|
|
5
|
-
def initialize
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def authenticate_with_http_basic(&block)
|
|
9
|
-
yield http_user, http_password
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def cookies
|
|
13
|
-
@cookies ||= MockCookieJar.new
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def cookie_domain
|
|
17
|
-
nil
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def params
|
|
21
|
-
@params ||= {}
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def request
|
|
25
|
-
@request ||= MockRequest.new
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def request_content_type
|
|
29
|
-
@request_content_type ||= "text/html"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def session
|
|
33
|
-
@session ||= {}
|
|
34
|
-
end
|
|
35
|
-
end
|