authlogic 3.4.6 → 3.5.0
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +33 -0
- data/.rubocop_todo.yml +427 -0
- data/.travis.yml +24 -3
- data/CHANGELOG.md +9 -2
- data/CONTRIBUTING.md +40 -1
- data/Gemfile +1 -1
- data/README.md +295 -0
- data/Rakefile +10 -2
- data/authlogic.gemspec +6 -5
- data/lib/authlogic.rb +2 -2
- data/lib/authlogic/acts_as_authentic/base.rb +2 -2
- data/lib/authlogic/acts_as_authentic/email.rb +59 -14
- data/lib/authlogic/acts_as_authentic/logged_in_status.rb +4 -3
- data/lib/authlogic/acts_as_authentic/login.rb +62 -12
- data/lib/authlogic/acts_as_authentic/magic_columns.rb +17 -6
- data/lib/authlogic/acts_as_authentic/password.rb +107 -53
- data/lib/authlogic/acts_as_authentic/persistence_token.rb +10 -9
- data/lib/authlogic/acts_as_authentic/restful_authentication.rb +2 -0
- data/lib/authlogic/acts_as_authentic/session_maintenance.rb +48 -35
- data/lib/authlogic/acts_as_authentic/single_access_token.rb +19 -15
- data/lib/authlogic/acts_as_authentic/validations_scope.rb +2 -2
- data/lib/authlogic/authenticates_many/association.rb +6 -5
- data/lib/authlogic/authenticates_many/base.rb +22 -12
- data/lib/authlogic/config.rb +2 -1
- data/lib/authlogic/controller_adapters/abstract_adapter.rb +2 -1
- data/lib/authlogic/controller_adapters/rack_adapter.rb +3 -4
- data/lib/authlogic/controller_adapters/rails_adapter.rb +26 -14
- data/lib/authlogic/controller_adapters/sinatra_adapter.rb +1 -1
- data/lib/authlogic/crypto_providers/aes256.rb +16 -12
- data/lib/authlogic/crypto_providers/bcrypt.rb +10 -4
- data/lib/authlogic/crypto_providers/md5.rb +7 -7
- data/lib/authlogic/crypto_providers/scrypt.rb +10 -2
- data/lib/authlogic/crypto_providers/sha1.rb +3 -3
- data/lib/authlogic/crypto_providers/sha256.rb +3 -3
- data/lib/authlogic/crypto_providers/sha512.rb +4 -4
- data/lib/authlogic/crypto_providers/wordpress.rb +13 -13
- data/lib/authlogic/i18n.rb +22 -16
- data/lib/authlogic/i18n/translator.rb +1 -1
- data/lib/authlogic/random.rb +13 -12
- data/lib/authlogic/regex.rb +3 -3
- data/lib/authlogic/session/activation.rb +7 -6
- data/lib/authlogic/session/active_record_trickery.rb +1 -2
- data/lib/authlogic/session/base.rb +7 -6
- data/lib/authlogic/session/brute_force_protection.rb +58 -34
- data/lib/authlogic/session/callbacks.rb +16 -12
- data/lib/authlogic/session/cookies.rb +29 -14
- data/lib/authlogic/session/existence.rb +10 -10
- data/lib/authlogic/session/foundation.rb +11 -7
- data/lib/authlogic/session/http_auth.rb +6 -5
- data/lib/authlogic/session/id.rb +5 -4
- data/lib/authlogic/session/klass.rb +2 -1
- data/lib/authlogic/session/magic_columns.rb +21 -14
- data/lib/authlogic/session/magic_states.rb +25 -14
- data/lib/authlogic/session/params.rb +41 -26
- data/lib/authlogic/session/password.rb +62 -40
- data/lib/authlogic/session/perishable_token.rb +3 -2
- data/lib/authlogic/session/persistence.rb +3 -3
- data/lib/authlogic/session/priority_record.rb +5 -4
- data/lib/authlogic/session/scopes.rb +20 -9
- data/lib/authlogic/session/session.rb +9 -4
- data/lib/authlogic/session/timeout.rb +40 -23
- data/lib/authlogic/session/unauthorized_record.rb +6 -5
- data/lib/authlogic/session/validation.rb +18 -9
- data/lib/authlogic/test_case.rb +2 -2
- data/lib/authlogic/test_case/mock_controller.rb +9 -9
- data/lib/authlogic/test_case/mock_cookie_jar.rb +2 -2
- data/lib/authlogic/test_case/mock_logger.rb +1 -1
- data/lib/authlogic/test_case/mock_request.rb +2 -1
- data/lib/authlogic/test_case/rails_request_adapter.rb +5 -5
- data/test/acts_as_authentic_test/email_test.rb +29 -17
- data/test/acts_as_authentic_test/logged_in_status_test.rb +9 -3
- data/test/acts_as_authentic_test/login_test.rb +47 -13
- data/test/acts_as_authentic_test/magic_columns_test.rb +4 -4
- data/test/acts_as_authentic_test/password_test.rb +31 -21
- data/test/acts_as_authentic_test/perishable_token_test.rb +15 -15
- data/test/acts_as_authentic_test/session_maintenance_test.rb +20 -13
- data/test/acts_as_authentic_test/single_access_test.rb +8 -8
- data/test/authenticates_many_test.rb +4 -4
- data/test/crypto_provider_test/aes256_test.rb +2 -2
- data/test/crypto_provider_test/scrypt_test.rb +1 -1
- data/test/crypto_provider_test/sha1_test.rb +3 -3
- data/test/crypto_provider_test/sha256_test.rb +1 -1
- data/test/crypto_provider_test/sha512_test.rb +2 -2
- data/test/gemfiles/Gemfile.rails-3.2.x +2 -2
- data/test/gemfiles/Gemfile.rails-5.0.x +6 -0
- data/test/i18n_test.rb +5 -5
- data/test/libs/affiliate.rb +2 -2
- data/test/libs/company.rb +1 -1
- data/test/libs/employee.rb +2 -2
- data/test/libs/employee_session.rb +1 -1
- data/test/libs/ldaper.rb +1 -1
- data/test/libs/project.rb +1 -1
- data/test/random_test.rb +5 -4
- data/test/session_test/activation_test.rb +5 -5
- data/test/session_test/active_record_trickery_test.rb +7 -5
- data/test/session_test/cookies_test.rb +8 -6
- data/test/session_test/existence_test.rb +19 -13
- data/test/session_test/http_auth_test.rb +0 -3
- data/test/session_test/id_test.rb +2 -2
- data/test/session_test/klass_test.rb +1 -1
- data/test/session_test/magic_columns_test.rb +0 -3
- data/test/session_test/magic_states_test.rb +11 -11
- data/test/session_test/params_test.rb +10 -10
- data/test/session_test/password_test.rb +4 -5
- data/test/session_test/perishability_test.rb +3 -3
- data/test/session_test/scopes_test.rb +8 -8
- data/test/session_test/session_test.rb +5 -4
- data/test/session_test/timeout_test.rb +8 -8
- data/test/session_test/unauthorized_record_test.rb +2 -2
- data/test/session_test/validation_test.rb +3 -3
- data/test/test_helper.rb +9 -5
- metadata +54 -24
- data/README.rdoc +0 -232
@@ -7,21 +7,21 @@ module ActsAsAuthenticTest
|
|
7
7
|
u.login_count = -1
|
8
8
|
assert !u.valid?
|
9
9
|
assert u.errors[:login_count].size > 0
|
10
|
-
|
10
|
+
|
11
11
|
u.login_count = 0
|
12
12
|
assert !u.valid?
|
13
13
|
assert u.errors[:login_count].size == 0
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def test_validates_numericality_of_failed_login_count
|
17
17
|
u = User.new
|
18
18
|
u.failed_login_count = -1
|
19
19
|
assert !u.valid?
|
20
20
|
assert u.errors[:failed_login_count].size > 0
|
21
|
-
|
21
|
+
|
22
22
|
u.failed_login_count = 0
|
23
23
|
assert !u.valid?
|
24
24
|
assert u.errors[:failed_login_count].size == 0
|
25
25
|
end
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
@@ -2,6 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module ActsAsAuthenticTest
|
4
4
|
class PasswordTest < ActiveSupport::TestCase
|
5
|
+
i_suck_and_my_tests_are_order_dependent! # If test_human_name is executed after test_i18n_of_human_name the test will fail.
|
5
6
|
def test_crypted_password_field_config
|
6
7
|
assert_equal :crypted_password, User.crypted_password_field
|
7
8
|
assert_equal :crypted_password, Employee.crypted_password_field
|
@@ -51,34 +52,34 @@ module ActsAsAuthenticTest
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def test_validates_length_of_password_field_options_config
|
54
|
-
default = {:minimum =>
|
55
|
+
default = { :minimum => 8, :if => :require_password? }
|
55
56
|
assert_equal default, User.validates_length_of_password_field_options
|
56
57
|
assert_equal default, Employee.validates_length_of_password_field_options
|
57
58
|
|
58
|
-
User.validates_length_of_password_field_options = {:yes => "no"}
|
59
|
-
assert_equal({:yes => "no"}, User.validates_length_of_password_field_options)
|
59
|
+
User.validates_length_of_password_field_options = { :yes => "no" }
|
60
|
+
assert_equal({ :yes => "no" }, User.validates_length_of_password_field_options)
|
60
61
|
User.validates_length_of_password_field_options default
|
61
62
|
assert_equal default, User.validates_length_of_password_field_options
|
62
63
|
end
|
63
64
|
|
64
65
|
def test_validates_confirmation_of_password_field_options_config
|
65
|
-
default = {:if => :require_password?}
|
66
|
+
default = { :if => :require_password? }
|
66
67
|
assert_equal default, User.validates_confirmation_of_password_field_options
|
67
68
|
assert_equal default, Employee.validates_confirmation_of_password_field_options
|
68
69
|
|
69
|
-
User.validates_confirmation_of_password_field_options = {:yes => "no"}
|
70
|
-
assert_equal({:yes => "no"}, User.validates_confirmation_of_password_field_options)
|
70
|
+
User.validates_confirmation_of_password_field_options = { :yes => "no" }
|
71
|
+
assert_equal({ :yes => "no" }, User.validates_confirmation_of_password_field_options)
|
71
72
|
User.validates_confirmation_of_password_field_options default
|
72
73
|
assert_equal default, User.validates_confirmation_of_password_field_options
|
73
74
|
end
|
74
75
|
|
75
76
|
def test_validates_length_of_password_confirmation_field_options_config
|
76
|
-
default = {:minimum =>
|
77
|
+
default = { :minimum => 8, :if => :require_password? }
|
77
78
|
assert_equal default, User.validates_length_of_password_confirmation_field_options
|
78
79
|
assert_equal default, Employee.validates_length_of_password_confirmation_field_options
|
79
80
|
|
80
|
-
User.validates_length_of_password_confirmation_field_options = {:yes => "no"}
|
81
|
-
assert_equal({:yes => "no"}, User.validates_length_of_password_confirmation_field_options)
|
81
|
+
User.validates_length_of_password_confirmation_field_options = { :yes => "no" }
|
82
|
+
assert_equal({ :yes => "no" }, User.validates_length_of_password_confirmation_field_options)
|
82
83
|
User.validates_length_of_password_confirmation_field_options default
|
83
84
|
assert_equal default, User.validates_length_of_password_confirmation_field_options
|
84
85
|
end
|
@@ -104,21 +105,21 @@ module ActsAsAuthenticTest
|
|
104
105
|
end
|
105
106
|
|
106
107
|
def test_validates_length_of_password
|
107
|
-
u = User.new(login: "abcde", email: "abcde@test.com", password: "
|
108
|
+
u = User.new(login: "abcde", email: "abcde@test.com", password: "abcdefgh", password_confirmation: "abcdefgh")
|
108
109
|
assert u.valid?
|
109
110
|
|
110
|
-
u.password = u.password_confirmation = "
|
111
|
+
u.password = u.password_confirmation = "abcdef"
|
111
112
|
assert !u.valid?
|
112
113
|
|
113
|
-
assert u.errors[:password].include?("is too short (minimum is
|
114
|
-
assert u.errors[:password_confirmation].include?("is too short (minimum is
|
114
|
+
assert u.errors[:password].include?("is too short (minimum is 8 characters)")
|
115
|
+
assert u.errors[:password_confirmation].include?("is too short (minimum is 8 characters)")
|
115
116
|
end
|
116
117
|
|
117
118
|
def test_validates_confirmation_of_password
|
118
|
-
u = User.new(login: "abcde", email: "abcde@test.com", password: "
|
119
|
+
u = User.new(login: "abcde", email: "abcde@test.com", password: "abcdefgh", password_confirmation: "abcdefgh")
|
119
120
|
assert u.valid?
|
120
121
|
|
121
|
-
u.password_confirmation = "
|
122
|
+
u.password_confirmation = "abcdefghij"
|
122
123
|
assert !u.valid?
|
123
124
|
|
124
125
|
if ActiveModel.respond_to?(:version) and ActiveModel.version.segments.first >= 4
|
@@ -131,23 +132,23 @@ module ActsAsAuthenticTest
|
|
131
132
|
def test_validates_length_of_password_confirmation
|
132
133
|
u = User.new
|
133
134
|
|
134
|
-
u.password = "
|
135
|
+
u.password = "testpass"
|
135
136
|
u.password_confirmation = ""
|
136
137
|
assert !u.valid?
|
137
138
|
assert u.errors[:password_confirmation].size > 0
|
138
139
|
|
139
|
-
u.password_confirmation = "
|
140
|
+
u.password_confirmation = "testpass"
|
140
141
|
assert !u.valid?
|
141
142
|
assert u.errors[:password_confirmation].size == 0
|
142
143
|
|
143
144
|
ben = users(:ben)
|
144
145
|
assert ben.valid?
|
145
146
|
|
146
|
-
ben.password = "
|
147
|
+
ben.password = "newpasswd"
|
147
148
|
assert !ben.valid?
|
148
149
|
assert ben.errors[:password_confirmation].size > 0
|
149
150
|
|
150
|
-
ben.password_confirmation = "
|
151
|
+
ben.password_confirmation = "newpasswd"
|
151
152
|
assert ben.valid?
|
152
153
|
end
|
153
154
|
|
@@ -164,8 +165,16 @@ module ActsAsAuthenticTest
|
|
164
165
|
ben = users(:ben)
|
165
166
|
|
166
167
|
transition_password_to(Authlogic::CryptoProviders::BCrypt, ben)
|
167
|
-
transition_password_to(
|
168
|
-
|
168
|
+
transition_password_to(
|
169
|
+
Authlogic::CryptoProviders::Sha1,
|
170
|
+
ben,
|
171
|
+
[Authlogic::CryptoProviders::Sha512, Authlogic::CryptoProviders::BCrypt]
|
172
|
+
)
|
173
|
+
transition_password_to(
|
174
|
+
Authlogic::CryptoProviders::Sha512,
|
175
|
+
ben,
|
176
|
+
[Authlogic::CryptoProviders::Sha1, Authlogic::CryptoProviders::BCrypt]
|
177
|
+
)
|
169
178
|
end
|
170
179
|
|
171
180
|
def test_checks_password_against_database
|
@@ -215,6 +224,7 @@ module ActsAsAuthenticTest
|
|
215
224
|
end
|
216
225
|
|
217
226
|
private
|
227
|
+
|
218
228
|
def transition_password_to(crypto_provider, records, from_crypto_providers = Authlogic::CryptoProviders::Sha512)
|
219
229
|
records = [records] unless records.is_a?(Array)
|
220
230
|
User.acts_as_authentic do |c|
|
@@ -5,73 +5,73 @@ module ActsAsAuthenticTest
|
|
5
5
|
def test_perishable_token_valid_for_config
|
6
6
|
assert_equal 10.minutes.to_i, User.perishable_token_valid_for
|
7
7
|
assert_equal 10.minutes.to_i, Employee.perishable_token_valid_for
|
8
|
-
|
8
|
+
|
9
9
|
User.perishable_token_valid_for = 1.hour
|
10
10
|
assert_equal 1.hour.to_i, User.perishable_token_valid_for
|
11
11
|
User.perishable_token_valid_for 10.minutes
|
12
12
|
assert_equal 10.minutes.to_i, User.perishable_token_valid_for
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def test_disable_perishable_token_maintenance_config
|
16
16
|
assert !User.disable_perishable_token_maintenance
|
17
17
|
assert !Employee.disable_perishable_token_maintenance
|
18
|
-
|
18
|
+
|
19
19
|
User.disable_perishable_token_maintenance = true
|
20
20
|
assert User.disable_perishable_token_maintenance
|
21
21
|
User.disable_perishable_token_maintenance false
|
22
22
|
assert !User.disable_perishable_token_maintenance
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def test_validates_uniqueness_of_perishable_token
|
26
26
|
u = User.new
|
27
27
|
u.perishable_token = users(:ben).perishable_token
|
28
28
|
assert !u.valid?
|
29
29
|
assert u.errors[:perishable_token].size > 0
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def test_before_save_reset_perishable_token
|
33
33
|
ben = users(:ben)
|
34
34
|
old_perishable_token = ben.perishable_token
|
35
35
|
assert ben.save
|
36
36
|
assert_not_equal old_perishable_token, ben.perishable_token
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def test_reset_perishable_token
|
40
40
|
ben = users(:ben)
|
41
41
|
old_perishable_token = ben.perishable_token
|
42
|
-
|
42
|
+
|
43
43
|
assert ben.reset_perishable_token
|
44
44
|
assert_not_equal old_perishable_token, ben.perishable_token
|
45
|
-
|
45
|
+
|
46
46
|
ben.reload
|
47
47
|
assert_equal old_perishable_token, ben.perishable_token
|
48
|
-
|
48
|
+
|
49
49
|
assert ben.reset_perishable_token!
|
50
50
|
assert_not_equal old_perishable_token, ben.perishable_token
|
51
|
-
|
51
|
+
|
52
52
|
ben.reload
|
53
53
|
assert_not_equal old_perishable_token, ben.perishable_token
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def test_find_using_perishable_token
|
57
57
|
ben = users(:ben)
|
58
58
|
assert_equal ben, User.find_using_perishable_token(ben.perishable_token)
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def test_find_using_perishable_token_when_perished
|
62
62
|
ben = users(:ben)
|
63
63
|
ActiveRecord::Base.connection.execute("UPDATE users set updated_at = '#{1.week.ago.to_s(:db)}' where id = #{ben.id}")
|
64
64
|
assert_nil User.find_using_perishable_token(ben.perishable_token)
|
65
65
|
end
|
66
|
-
|
67
|
-
def
|
66
|
+
|
67
|
+
def test_find_using_perishable_token_when_perished_2
|
68
68
|
User.perishable_token_valid_for = 1.minute
|
69
69
|
ben = users(:ben)
|
70
70
|
ActiveRecord::Base.connection.execute("UPDATE users set updated_at = '#{2.minutes.ago.to_s(:db)}' where id = #{ben.id}")
|
71
71
|
assert_nil User.find_using_perishable_token(ben.perishable_token)
|
72
72
|
User.perishable_token_valid_for = 10.minutes
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def test_find_using_perishable_token_when_passing_threshold
|
76
76
|
User.perishable_token_valid_for = 1.minute
|
77
77
|
ben = users(:ben)
|
@@ -9,17 +9,24 @@ module ActsAsAuthenticTest
|
|
9
9
|
User.maintain_sessions true
|
10
10
|
assert User.maintain_sessions
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def test_login_after_create
|
14
|
-
assert
|
14
|
+
assert(
|
15
|
+
User.create(
|
16
|
+
:login => "awesome",
|
17
|
+
:password => "saweeeet",
|
18
|
+
:password_confirmation => "saweeeet",
|
19
|
+
:email => "awesome@awesome.com"
|
20
|
+
)
|
21
|
+
)
|
15
22
|
assert UserSession.find
|
16
23
|
end
|
17
|
-
|
24
|
+
|
18
25
|
def test_updating_session_with_failed_magic_state
|
19
26
|
ben = users(:ben)
|
20
27
|
ben.confirmed = false
|
21
|
-
ben.password = "
|
22
|
-
ben.password_confirmation = "
|
28
|
+
ben.password = "newpasswd"
|
29
|
+
ben.password_confirmation = "newpasswd"
|
23
30
|
assert ben.save
|
24
31
|
end
|
25
32
|
|
@@ -28,8 +35,8 @@ module ActsAsAuthenticTest
|
|
28
35
|
UserSession.create(ben)
|
29
36
|
old_session_key = controller.session["user_credentials"]
|
30
37
|
old_cookie_key = controller.cookies["user_credentials"]
|
31
|
-
ben.password = "
|
32
|
-
ben.password_confirmation = "
|
38
|
+
ben.password = "newpasswd"
|
39
|
+
ben.password_confirmation = "newpasswd"
|
33
40
|
assert ben.save
|
34
41
|
assert controller.session["user_credentials"]
|
35
42
|
assert controller.cookies["user_credentials"]
|
@@ -47,7 +54,7 @@ module ActsAsAuthenticTest
|
|
47
54
|
assert_equal controller.session["user_credentials"], old_session_key
|
48
55
|
assert_equal controller.cookies["user_credentials"], old_cookie_key
|
49
56
|
end
|
50
|
-
|
57
|
+
|
51
58
|
def test_creating_other_user
|
52
59
|
ben = users(:ben)
|
53
60
|
UserSession.create(ben)
|
@@ -64,8 +71,8 @@ module ActsAsAuthenticTest
|
|
64
71
|
old_session_key = controller.session["user_credentials"]
|
65
72
|
old_cookie_key = controller.cookies["user_credentials"]
|
66
73
|
zack = users(:zack)
|
67
|
-
zack.password = "
|
68
|
-
zack.password_confirmation = "
|
74
|
+
zack.password = "newpasswd"
|
75
|
+
zack.password_confirmation = "newpasswd"
|
69
76
|
assert zack.save
|
70
77
|
assert_equal controller.session["user_credentials"], old_session_key
|
71
78
|
assert_equal controller.cookies["user_credentials"], old_cookie_key
|
@@ -74,11 +81,11 @@ module ActsAsAuthenticTest
|
|
74
81
|
def test_resetting_password_when_logged_out
|
75
82
|
ben = users(:ben)
|
76
83
|
assert !UserSession.find
|
77
|
-
ben.password = "
|
78
|
-
ben.password_confirmation = "
|
84
|
+
ben.password = "newpasswd"
|
85
|
+
ben.password_confirmation = "newpasswd"
|
79
86
|
assert ben.save
|
80
87
|
assert UserSession.find
|
81
88
|
assert_equal ben, UserSession.find.record
|
82
89
|
end
|
83
90
|
end
|
84
|
-
end
|
91
|
+
end
|
@@ -5,40 +5,40 @@ module ActsAsAuthenticTest
|
|
5
5
|
def test_change_single_access_token_with_password_config
|
6
6
|
assert !User.change_single_access_token_with_password
|
7
7
|
assert !Employee.change_single_access_token_with_password
|
8
|
-
|
8
|
+
|
9
9
|
User.change_single_access_token_with_password = true
|
10
10
|
assert User.change_single_access_token_with_password
|
11
11
|
User.change_single_access_token_with_password false
|
12
12
|
assert !User.change_single_access_token_with_password
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def test_validates_uniqueness_of_single_access_token
|
16
16
|
u = User.new
|
17
17
|
u.single_access_token = users(:ben).single_access_token
|
18
18
|
assert !u.valid?
|
19
19
|
assert u.errors[:single_access_token].size > 0
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def test_before_validation_reset_single_access_token
|
23
23
|
u = User.new
|
24
24
|
assert !u.valid?
|
25
25
|
assert_not_nil u.single_access_token
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def test_after_password_set_reset_single_access_token
|
29
29
|
User.change_single_access_token_with_password = true
|
30
|
-
|
30
|
+
|
31
31
|
ben = users(:ben)
|
32
32
|
old_single_access_token = ben.single_access_token
|
33
33
|
ben.password = "new_pass"
|
34
34
|
assert_not_equal old_single_access_token, ben.single_access_token
|
35
|
-
|
35
|
+
|
36
36
|
User.change_single_access_token_with_password = false
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def test_after_password_set_is_not_called
|
40
40
|
ldaper = Ldaper.new
|
41
41
|
assert ldaper.save
|
42
42
|
end
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
@@ -6,11 +6,11 @@ class AuthenticatesManyTest < ActiveSupport::TestCase
|
|
6
6
|
ben = users(:ben)
|
7
7
|
binary_logic = companies(:binary_logic)
|
8
8
|
set_session_for(zack)
|
9
|
-
|
9
|
+
|
10
10
|
assert !binary_logic.user_sessions.find
|
11
|
-
|
11
|
+
|
12
12
|
set_session_for(ben)
|
13
|
-
|
13
|
+
|
14
14
|
assert binary_logic.user_sessions.find
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
@@ -5,10 +5,10 @@ module CryptoProviderTest
|
|
5
5
|
def test_encrypt
|
6
6
|
assert Authlogic::CryptoProviders::AES256.encrypt("mypass")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_matches
|
10
10
|
hash = Authlogic::CryptoProviders::AES256.encrypt("mypass")
|
11
11
|
assert Authlogic::CryptoProviders::AES256.matches?(hash, "mypass")
|
12
12
|
end
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
@@ -5,7 +5,7 @@ module CryptoProviderTest
|
|
5
5
|
def test_encrypt
|
6
6
|
assert Authlogic::CryptoProviders::SCrypt.encrypt("mypass")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_matches
|
10
10
|
hash = Authlogic::CryptoProviders::SCrypt.encrypt("mypass")
|
11
11
|
assert Authlogic::CryptoProviders::SCrypt.matches?(hash, "mypass")
|
@@ -5,12 +5,12 @@ module CryptoProviderTest
|
|
5
5
|
def test_encrypt
|
6
6
|
assert Authlogic::CryptoProviders::Sha1.encrypt("mypass")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_matches
|
10
10
|
hash = Authlogic::CryptoProviders::Sha1.encrypt("mypass")
|
11
11
|
assert Authlogic::CryptoProviders::Sha1.matches?(hash, "mypass")
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def test_old_restful_authentication_passwords
|
15
15
|
password = "test"
|
16
16
|
salt = "7e3041ebc2fc05a40c60028e2c4901a81035d3cd"
|
@@ -20,4 +20,4 @@ module CryptoProviderTest
|
|
20
20
|
Authlogic::CryptoProviders::Sha1.stretches = 10
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -5,7 +5,7 @@ module CryptoProviderTest
|
|
5
5
|
def test_encrypt
|
6
6
|
assert Authlogic::CryptoProviders::Sha256.encrypt("mypass")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_matches
|
10
10
|
hash = Authlogic::CryptoProviders::Sha256.encrypt("mypass")
|
11
11
|
assert Authlogic::CryptoProviders::Sha256.matches?(hash, "mypass")
|
@@ -5,10 +5,10 @@ module CryptoProviderTest
|
|
5
5
|
def test_encrypt
|
6
6
|
assert Authlogic::CryptoProviders::Sha512.encrypt("mypass")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_matches
|
10
10
|
hash = Authlogic::CryptoProviders::Sha512.encrypt("mypass")
|
11
11
|
assert Authlogic::CryptoProviders::Sha512.matches?(hash, "mypass")
|
12
12
|
end
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|