authlogic 3.8.0 → 4.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.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  3. data/.github/ISSUE_TEMPLATE/feature_proposal.md +32 -0
  4. data/.github/triage.md +86 -0
  5. data/.gitignore +4 -3
  6. data/.rubocop.yml +109 -9
  7. data/.rubocop_todo.yml +38 -355
  8. data/.travis.yml +11 -35
  9. data/CHANGELOG.md +345 -2
  10. data/CONTRIBUTING.md +45 -14
  11. data/Gemfile +3 -2
  12. data/README.md +244 -90
  13. data/Rakefile +10 -10
  14. data/UPGRADING.md +22 -0
  15. data/authlogic.gemspec +34 -21
  16. data/doc/use_normal_rails_validation.md +82 -0
  17. data/gemfiles/Gemfile.rails-4.2.x +6 -0
  18. data/{test/gemfiles → gemfiles}/Gemfile.rails-5.1.x +2 -2
  19. data/{test/gemfiles → gemfiles}/Gemfile.rails-5.2.x +2 -2
  20. data/lib/authlogic/acts_as_authentic/base.rb +36 -24
  21. data/lib/authlogic/acts_as_authentic/email.rb +65 -31
  22. data/lib/authlogic/acts_as_authentic/logged_in_status.rb +14 -9
  23. data/lib/authlogic/acts_as_authentic/login.rb +61 -45
  24. data/lib/authlogic/acts_as_authentic/magic_columns.rb +6 -6
  25. data/lib/authlogic/acts_as_authentic/password.rb +267 -146
  26. data/lib/authlogic/acts_as_authentic/perishable_token.rb +24 -19
  27. data/lib/authlogic/acts_as_authentic/persistence_token.rb +10 -15
  28. data/lib/authlogic/acts_as_authentic/queries/find_with_case.rb +67 -0
  29. data/lib/authlogic/acts_as_authentic/restful_authentication.rb +50 -14
  30. data/lib/authlogic/acts_as_authentic/session_maintenance.rb +88 -60
  31. data/lib/authlogic/acts_as_authentic/single_access_token.rb +23 -11
  32. data/lib/authlogic/acts_as_authentic/validations_scope.rb +9 -6
  33. data/lib/authlogic/authenticates_many/association.rb +7 -7
  34. data/lib/authlogic/authenticates_many/base.rb +37 -21
  35. data/lib/authlogic/config.rb +21 -10
  36. data/lib/authlogic/controller_adapters/abstract_adapter.rb +38 -11
  37. data/lib/authlogic/controller_adapters/rack_adapter.rb +9 -5
  38. data/lib/authlogic/controller_adapters/rails_adapter.rb +12 -7
  39. data/lib/authlogic/controller_adapters/sinatra_adapter.rb +2 -2
  40. data/lib/authlogic/crypto_providers/aes256.rb +37 -32
  41. data/lib/authlogic/crypto_providers/bcrypt.rb +21 -15
  42. data/lib/authlogic/crypto_providers/md5.rb +4 -2
  43. data/lib/authlogic/crypto_providers/scrypt.rb +22 -17
  44. data/lib/authlogic/crypto_providers/sha1.rb +11 -5
  45. data/lib/authlogic/crypto_providers/sha256.rb +13 -9
  46. data/lib/authlogic/crypto_providers/sha512.rb +0 -21
  47. data/lib/authlogic/crypto_providers/wordpress.rb +32 -3
  48. data/lib/authlogic/crypto_providers.rb +91 -0
  49. data/lib/authlogic/i18n.rb +26 -19
  50. data/lib/authlogic/random.rb +10 -28
  51. data/lib/authlogic/regex.rb +59 -28
  52. data/lib/authlogic/session/activation.rb +10 -7
  53. data/lib/authlogic/session/active_record_trickery.rb +13 -9
  54. data/lib/authlogic/session/base.rb +15 -4
  55. data/lib/authlogic/session/brute_force_protection.rb +40 -33
  56. data/lib/authlogic/session/callbacks.rb +94 -46
  57. data/lib/authlogic/session/cookies.rb +130 -45
  58. data/lib/authlogic/session/existence.rb +21 -11
  59. data/lib/authlogic/session/foundation.rb +64 -14
  60. data/lib/authlogic/session/http_auth.rb +35 -28
  61. data/lib/authlogic/session/id.rb +9 -4
  62. data/lib/authlogic/session/klass.rb +15 -12
  63. data/lib/authlogic/session/magic_columns.rb +58 -55
  64. data/lib/authlogic/session/magic_states.rb +25 -19
  65. data/lib/authlogic/session/params.rb +42 -28
  66. data/lib/authlogic/session/password.rb +130 -120
  67. data/lib/authlogic/session/perishable_token.rb +5 -4
  68. data/lib/authlogic/session/persistence.rb +18 -12
  69. data/lib/authlogic/session/priority_record.rb +15 -12
  70. data/lib/authlogic/session/scopes.rb +51 -32
  71. data/lib/authlogic/session/session.rb +38 -28
  72. data/lib/authlogic/session/timeout.rb +13 -13
  73. data/lib/authlogic/session/unauthorized_record.rb +18 -13
  74. data/lib/authlogic/session/validation.rb +9 -9
  75. data/lib/authlogic/test_case/mock_controller.rb +5 -4
  76. data/lib/authlogic/test_case/mock_cookie_jar.rb +47 -3
  77. data/lib/authlogic/test_case/mock_request.rb +6 -3
  78. data/lib/authlogic/test_case/rails_request_adapter.rb +3 -2
  79. data/lib/authlogic/test_case.rb +70 -2
  80. data/lib/authlogic/version.rb +21 -0
  81. data/lib/authlogic.rb +51 -49
  82. data/test/acts_as_authentic_test/base_test.rb +3 -1
  83. data/test/acts_as_authentic_test/email_test.rb +43 -42
  84. data/test/acts_as_authentic_test/logged_in_status_test.rb +6 -4
  85. data/test/acts_as_authentic_test/login_test.rb +77 -80
  86. data/test/acts_as_authentic_test/magic_columns_test.rb +3 -1
  87. data/test/acts_as_authentic_test/password_test.rb +51 -37
  88. data/test/acts_as_authentic_test/perishable_token_test.rb +13 -5
  89. data/test/acts_as_authentic_test/persistence_token_test.rb +7 -1
  90. data/test/acts_as_authentic_test/restful_authentication_test.rb +14 -3
  91. data/test/acts_as_authentic_test/session_maintenance_test.rb +69 -15
  92. data/test/acts_as_authentic_test/single_access_test.rb +3 -1
  93. data/test/adapter_test.rb +23 -0
  94. data/test/authenticates_many_test.rb +3 -1
  95. data/test/config_test.rb +11 -9
  96. data/test/crypto_provider_test/aes256_test.rb +3 -1
  97. data/test/crypto_provider_test/bcrypt_test.rb +3 -1
  98. data/test/crypto_provider_test/scrypt_test.rb +3 -1
  99. data/test/crypto_provider_test/sha1_test.rb +3 -1
  100. data/test/crypto_provider_test/sha256_test.rb +3 -1
  101. data/test/crypto_provider_test/sha512_test.rb +3 -1
  102. data/test/crypto_provider_test/wordpress_test.rb +26 -0
  103. data/test/fixtures/companies.yml +2 -2
  104. data/test/fixtures/employees.yml +1 -1
  105. data/test/i18n_test.rb +6 -4
  106. data/test/libs/affiliate.rb +2 -0
  107. data/test/libs/company.rb +4 -2
  108. data/test/libs/employee.rb +2 -0
  109. data/test/libs/employee_session.rb +2 -0
  110. data/test/libs/ldaper.rb +2 -0
  111. data/test/libs/project.rb +2 -0
  112. data/test/libs/user.rb +2 -0
  113. data/test/libs/user_session.rb +4 -2
  114. data/test/random_test.rb +10 -38
  115. data/test/session_test/activation_test.rb +3 -1
  116. data/test/session_test/active_record_trickery_test.rb +7 -4
  117. data/test/session_test/brute_force_protection_test.rb +11 -9
  118. data/test/session_test/callbacks_test.rb +12 -4
  119. data/test/session_test/cookies_test.rb +48 -5
  120. data/test/session_test/existence_test.rb +18 -5
  121. data/test/session_test/foundation_test.rb +19 -1
  122. data/test/session_test/http_auth_test.rb +11 -7
  123. data/test/session_test/id_test.rb +3 -1
  124. data/test/session_test/klass_test.rb +3 -1
  125. data/test/session_test/magic_columns_test.rb +13 -13
  126. data/test/session_test/magic_states_test.rb +3 -1
  127. data/test/session_test/params_test.rb +13 -5
  128. data/test/session_test/password_test.rb +10 -8
  129. data/test/session_test/perishability_test.rb +3 -1
  130. data/test/session_test/persistence_test.rb +4 -1
  131. data/test/session_test/scopes_test.rb +16 -8
  132. data/test/session_test/session_test.rb +6 -4
  133. data/test/session_test/timeout_test.rb +4 -2
  134. data/test/session_test/unauthorized_record_test.rb +4 -2
  135. data/test/session_test/validation_test.rb +3 -1
  136. data/test/test_helper.rb +84 -45
  137. metadata +87 -73
  138. data/.github/ISSUE_TEMPLATE.md +0 -13
  139. data/test/gemfiles/Gemfile.rails-3.2.x +0 -7
  140. data/test/gemfiles/Gemfile.rails-4.0.x +0 -7
  141. data/test/gemfiles/Gemfile.rails-4.1.x +0 -7
  142. data/test/gemfiles/Gemfile.rails-4.2.x +0 -7
  143. data/test/gemfiles/Gemfile.rails-5.0.x +0 -6
@@ -41,7 +41,7 @@ module Authlogic
41
41
  # they login and then leave the website, when do mark them as logged
42
42
  # out? I recommend just using this as a fun feature on your website or
43
43
  # reports, giving you a ballpark number of users logged in and active.
44
- # This is not meant to be a dead accurate representation of a users
44
+ # This is not meant to be a dead accurate representation of a user's
45
45
  # logged in state, since there is really no real way to do this with web
46
46
  # based apps. Think about a user that logs in and doesn't log out. There
47
47
  # is no action that tells you that the user isn't technically still
@@ -52,7 +52,7 @@ module Authlogic
52
52
  # this option to true and if your record returns true for stale? then
53
53
  # they will be required to log back in.
54
54
  #
55
- # Lastly, UserSession.find will still return a object is the session is
55
+ # Lastly, UserSession.find will still return an object if the session is
56
56
  # stale, but you will not get a record. This allows you to determine if
57
57
  # the user needs to log back in because their session went stale, or
58
58
  # because they just aren't logged in. Just call
@@ -83,20 +83,20 @@ module Authlogic
83
83
 
84
84
  private
85
85
 
86
- def reset_stale_state
87
- self.stale_record = nil
88
- end
86
+ def reset_stale_state
87
+ self.stale_record = nil
88
+ end
89
89
 
90
- def enforce_timeout
91
- if stale?
92
- self.stale_record = record
93
- self.record = nil
94
- end
90
+ def enforce_timeout
91
+ if stale?
92
+ self.stale_record = record
93
+ self.record = nil
95
94
  end
95
+ end
96
96
 
97
- def logout_on_timeout?
98
- self.class.logout_on_timeout == true
99
- end
97
+ def logout_on_timeout?
98
+ self.class.logout_on_timeout == true
99
+ end
100
100
  end
101
101
  end
102
102
  end
@@ -4,18 +4,23 @@ module Authlogic
4
4
  #
5
5
  # UserSession.create(my_user_object)
6
6
  #
7
- # Be careful with this, because Authlogic is assuming that you have already confirmed that the
8
- # user is who he says he is.
7
+ # Be careful with this, because Authlogic is assuming that you have already
8
+ # confirmed that the user is who he says he is.
9
9
  #
10
- # For example, this is the method used to persist the session internally. Authlogic finds the user with
11
- # the persistence token. At this point we know the user is who he says he is, so Authlogic just creates a
12
- # session with the record. This is particularly useful for 3rd party authentication methods, such as
13
- # OpenID. Let that method verify the identity, once it's verified, pass the object and create a session.
10
+ # For example, this is the method used to persist the session internally.
11
+ # Authlogic finds the user with the persistence token. At this point we know
12
+ # the user is who he says he is, so Authlogic just creates a session with
13
+ # the record. This is particularly useful for 3rd party authentication
14
+ # methods, such as OpenID. Let that method verify the identity, once it's
15
+ # verified, pass the object and create a session.
14
16
  module UnauthorizedRecord
15
17
  def self.included(klass)
16
18
  klass.class_eval do
17
19
  attr_accessor :unauthorized_record
18
- validate :validate_by_unauthorized_record, :if => :authenticating_with_unauthorized_record?
20
+ validate(
21
+ :validate_by_unauthorized_record,
22
+ if: :authenticating_with_unauthorized_record?
23
+ )
19
24
  end
20
25
  end
21
26
 
@@ -39,13 +44,13 @@ module Authlogic
39
44
 
40
45
  private
41
46
 
42
- def authenticating_with_unauthorized_record?
43
- !unauthorized_record.nil?
44
- end
47
+ def authenticating_with_unauthorized_record?
48
+ !unauthorized_record.nil?
49
+ end
45
50
 
46
- def validate_by_unauthorized_record
47
- self.attempted_record = unauthorized_record
48
- end
51
+ def validate_by_unauthorized_record
52
+ self.attempted_record = unauthorized_record
53
+ end
49
54
  end
50
55
  end
51
56
  end
@@ -77,17 +77,17 @@ module Authlogic
77
77
 
78
78
  private
79
79
 
80
- def ensure_authentication_attempted
81
- if errors.empty? && attempted_record.nil?
82
- errors.add(
83
- :base,
84
- I18n.t(
85
- 'error_messages.no_authentication_details',
86
- :default => "You did not provide any details for authentication."
87
- )
80
+ def ensure_authentication_attempted
81
+ if errors.empty? && attempted_record.nil?
82
+ errors.add(
83
+ :base,
84
+ I18n.t(
85
+ "error_messages.no_authentication_details",
86
+ default: "You did not provide any details for authentication."
88
87
  )
89
- end
88
+ )
90
89
  end
90
+ end
91
91
  end
92
92
  end
93
93
  end
@@ -1,7 +1,8 @@
1
1
  module Authlogic
2
2
  module TestCase
3
- # Basically acts like a controller but doesn't do anything. Authlogic can interact with this, do it's thing and then you
4
- # can look at the controller object to see if anything changed.
3
+ # Basically acts like a controller but doesn't do anything. Authlogic can interact
4
+ # with this, do it's thing and then you can look at the controller object to see if
5
+ # anything changed.
5
6
  class MockController < ControllerAdapters::AbstractAdapter
6
7
  attr_accessor :http_user, :http_password, :realm
7
8
  attr_writer :request_content_type
@@ -9,11 +10,11 @@ module Authlogic
9
10
  def initialize
10
11
  end
11
12
 
12
- def authenticate_with_http_basic(&block)
13
+ def authenticate_with_http_basic
13
14
  yield http_user, http_password
14
15
  end
15
16
 
16
- def authenticate_or_request_with_http_basic(realm = 'DefaultRealm', &block)
17
+ def authenticate_or_request_with_http_basic(realm = "DefaultRealm")
17
18
  self.realm = realm
18
19
  @http_auth_requested = true
19
20
  yield http_user, http_password
@@ -1,18 +1,30 @@
1
1
  module Authlogic
2
2
  module TestCase
3
+ # A mock of `ActionDispatch::Cookies::CookieJar`.
3
4
  class MockCookieJar < Hash # :nodoc:
5
+ attr_accessor :set_cookies
6
+
4
7
  def [](key)
5
8
  hash = super
6
9
  hash && hash[:value]
7
10
  end
8
11
 
9
- def delete(key, options = {})
12
+ def []=(key, options)
13
+ (@set_cookies ||= {})[key.to_s] = options
14
+ super
15
+ end
16
+
17
+ def delete(key, _options = {})
10
18
  super(key)
11
19
  end
12
20
 
13
21
  def signed
14
22
  @signed ||= MockSignedCookieJar.new(self)
15
23
  end
24
+
25
+ def encrypted
26
+ @encrypted ||= MockEncryptedCookieJar.new(self)
27
+ end
16
28
  end
17
29
 
18
30
  class MockSignedCookieJar < MockCookieJar
@@ -20,11 +32,13 @@ module Authlogic
20
32
 
21
33
  def initialize(parent_jar)
22
34
  @parent_jar = parent_jar
35
+ parent_jar.each { |k, v| self[k] = v }
23
36
  end
24
37
 
25
38
  def [](val)
26
- if signed_message = @parent_jar[val]
27
- payload, signature = signed_message.split('--')
39
+ signed_message = @parent_jar[val]
40
+ if signed_message
41
+ payload, signature = signed_message.split("--")
28
42
  raise "Invalid signature" unless Digest::SHA1.hexdigest(payload) == signature
29
43
  payload
30
44
  end
@@ -35,5 +49,35 @@ module Authlogic
35
49
  @parent_jar[key] = options
36
50
  end
37
51
  end
52
+
53
+ class MockEncryptedCookieJar < MockCookieJar
54
+ attr_reader :parent_jar # helper for testing
55
+
56
+ def initialize(parent_jar)
57
+ @parent_jar = parent_jar
58
+ parent_jar.each { |k, v| self[k] = v }
59
+ end
60
+
61
+ def [](val)
62
+ encrypted_message = @parent_jar[val]
63
+ if encrypted_message
64
+ self.class.decrypt(encrypted_message)
65
+ end
66
+ end
67
+
68
+ def []=(key, options)
69
+ options[:value] = self.class.encrypt(options[:value])
70
+ @parent_jar[key] = options
71
+ end
72
+
73
+ # simple caesar cipher for testing
74
+ def self.encrypt(str)
75
+ str.unpack("U*").map(&:succ).pack("U*")
76
+ end
77
+
78
+ def self.decrypt(str)
79
+ str.unpack("U*").map(&:pred).pack("U*")
80
+ end
81
+ end
38
82
  end
39
83
  end
@@ -8,13 +8,16 @@ module Authlogic
8
8
  end
9
9
 
10
10
  def ip
11
- (controller && controller.respond_to?(:env) && controller.env.is_a?(Hash) && controller.env['REMOTE_ADDR']) || "1.1.1.1"
11
+ controller&.respond_to?(:env) &&
12
+ controller.env.is_a?(Hash) &&
13
+ controller.env["REMOTE_ADDR"] ||
14
+ "1.1.1.1"
12
15
  end
13
16
 
14
17
  private
15
18
 
16
- def method_missing(*args, &block)
17
- end
19
+ def method_missing(*args, &block)
20
+ end
18
21
  end
19
22
  end
20
23
  end
@@ -1,7 +1,8 @@
1
1
  module Authlogic
2
2
  module TestCase
3
- # Adapts authlogic to work with the @request object when testing. This way Authlogic can set cookies and what not before
4
- # a request is made, ultimately letting you log in users in functional tests.
3
+ # Adapts authlogic to work with the @request object when testing. This way Authlogic
4
+ # can set cookies and what not before a request is made, ultimately letting you log in
5
+ # users in functional tests.
5
6
  class RailsRequestAdapter < ControllerAdapters::AbstractAdapter
6
7
  def authenticate_with_http_basic(&block)
7
8
  end
@@ -50,7 +50,7 @@ module Authlogic
50
50
  # ben:
51
51
  # email: whatever@whatever.com
52
52
  # password_salt: <%= salt = Authlogic::Random.hex_token %>
53
- # crypted_password: <%= Authlogic::CryptoProviders::Sha512.encrypt("benrocks" + salt) %>
53
+ # crypted_password: <%= Authlogic::CryptoProviders::SCrypt.encrypt("benrocks" + salt) %>
54
54
  # persistence_token: <%= Authlogic::Random.hex_token %>
55
55
  # single_access_token: <%= Authlogic::Random.friendly_token %>
56
56
  # perishable_token: <%= Authlogic::Random.friendly_token %>
@@ -113,7 +113,73 @@ module Authlogic
113
113
  #
114
114
  # See how I am checking that Authlogic is interacting with the controller
115
115
  # properly? That's the idea here.
116
+ #
117
+ # === Testing with Rails 5
118
+ #
119
+ # Rails 5 has [deprecated classic controller tests](https://goo.gl/4zmt6y).
120
+ # Controller tests now inherit from `ActionDispatch::IntegrationTest` making
121
+ # them plain old integration tests now. You have two options for testing
122
+ # AuthLogic in Rails 5:
123
+ #
124
+ # * Add the `rails-controller-testing` gem to bring back the original
125
+ # controller testing usage
126
+ # * Go full steam ahead with integration testing and actually log a user in
127
+ # by submitting a form in the integration test.
128
+ #
129
+ # Naturally DHH recommends the second method and this is
130
+ # [what he does in his own tests](https://goo.gl/Ar6p0u). This is useful
131
+ # for testing not only AuthLogic itself (submitting login credentials to a
132
+ # UserSessionsController, for example) but any controller action that is
133
+ # behind a login wall. Add a helper method and use that before testing your
134
+ # actual controller action:
135
+ #
136
+ # # test/test_helper.rb
137
+ # def login(user)
138
+ # post user_sessions_url, :params => { :email => user.email, :password => 'password' }
139
+ # end
140
+ #
141
+ # # test/controllers/posts_controller_test.rb
142
+ # test "#create requires a user to be logged in
143
+ # post posts_url, :params => { :body => 'Lorem ipsum' }
144
+ #
145
+ # assert_redirected_to new_user_session_url
146
+ # end
147
+ #
148
+ # test "#create lets a logged in user create a new post" do
149
+ # login(users(:admin))
150
+ #
151
+ # assert_difference 'Posts.count' do
152
+ # post posts_url, :params => { :body => 'Lorem ipsum' }
153
+ # end
154
+ #
155
+ # assert_redirected_to posts_url
156
+ # end
157
+ #
158
+ # You still have access to the `session` helper in an integration test and so
159
+ # you can still test to see if a user is logged in. A couple of helper methods
160
+ # might look like:
161
+ #
162
+ # # test/test_helper.rb
163
+ # def assert_logged_in
164
+ # assert session[:user_credentials].present?
165
+ # end
166
+ #
167
+ # def assert_not_logged_in
168
+ # assert session[:user_credentials].blank?
169
+ # end
170
+ #
171
+ # # test/user_sessions_controller_test.rb
172
+ # test "#create logs in a user" do
173
+ # login(users(:admin))
174
+ #
175
+ # assert_logged_in
176
+ # end
116
177
  module TestCase
178
+ def initialize(*args)
179
+ @request = nil
180
+ super
181
+ end
182
+
117
183
  # Activates authlogic so that you can use it in your tests. You should call
118
184
  # this method in your test's setup. Ex:
119
185
  #
@@ -125,7 +191,9 @@ module Authlogic
125
191
  end
126
192
  end
127
193
 
128
- Authlogic::Session::Base.controller = (@request && Authlogic::TestCase::RailsRequestAdapter.new(@request)) || controller
194
+ Authlogic::Session::Base.controller = @request &&
195
+ Authlogic::TestCase::RailsRequestAdapter.new(@request) ||
196
+ controller
129
197
  end
130
198
 
131
199
  # The Authlogic::TestCase::MockController object passed to Authlogic to
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+
5
+ module Authlogic
6
+ # Returns a `::Gem::Version`, the version number of the authlogic gem.
7
+ #
8
+ # It is preferable for a library to provide a `gem_version` method, rather
9
+ # than a `VERSION` string, because `::Gem::Version` is easier to use in a
10
+ # comparison.
11
+ #
12
+ # We cannot return a frozen `Version`, because rubygems will try to modify it.
13
+ # https://github.com/binarylogic/authlogic/pull/590
14
+ #
15
+ # Added in 4.0.0
16
+ #
17
+ # @api public
18
+ def self.gem_version
19
+ ::Gem::Version.new("4.5.0")
20
+ end
21
+ end
data/lib/authlogic.rb CHANGED
@@ -1,7 +1,9 @@
1
- # Authlogic uses ActiveSupport's core extensions like `strip_heredoc`, which
2
- # ActiveRecord does not `require`. It's possible that we could save a few
3
- # milliseconds by loading only the specific core extensions we need, but
4
- # `all.rb` is simpler. We can revisit this decision if it becomes a problem.
1
+ # Authlogic uses ActiveSupport's core extensions like `strip_heredoc` and
2
+ # `squish`. ActiveRecord does not `require` these exensions, so we must.
3
+ #
4
+ # It's possible that we could save a few milliseconds by loading only the
5
+ # specific core extensions we need, but `all.rb` is simpler. We can revisit this
6
+ # decision if it becomes a problem.
5
7
  require "active_support/all"
6
8
 
7
9
  require "active_record"
@@ -9,57 +11,57 @@ require "active_record"
9
11
  path = File.dirname(__FILE__) + "/authlogic/"
10
12
 
11
13
  [
12
- "i18n",
13
- "random",
14
- "regex",
15
- "config",
14
+ "i18n",
15
+ "random",
16
+ "regex",
17
+ "config",
16
18
 
17
- "controller_adapters/abstract_adapter",
19
+ "controller_adapters/abstract_adapter",
18
20
 
19
- "crypto_providers",
21
+ "crypto_providers",
20
22
 
21
- "authenticates_many/base",
22
- "authenticates_many/association",
23
+ "authenticates_many/base",
24
+ "authenticates_many/association",
23
25
 
24
- "acts_as_authentic/email",
25
- "acts_as_authentic/logged_in_status",
26
- "acts_as_authentic/login",
27
- "acts_as_authentic/magic_columns",
28
- "acts_as_authentic/password",
29
- "acts_as_authentic/perishable_token",
30
- "acts_as_authentic/persistence_token",
31
- "acts_as_authentic/restful_authentication",
32
- "acts_as_authentic/session_maintenance",
33
- "acts_as_authentic/single_access_token",
34
- "acts_as_authentic/validations_scope",
35
- "acts_as_authentic/base",
26
+ "acts_as_authentic/email",
27
+ "acts_as_authentic/logged_in_status",
28
+ "acts_as_authentic/login",
29
+ "acts_as_authentic/magic_columns",
30
+ "acts_as_authentic/password",
31
+ "acts_as_authentic/perishable_token",
32
+ "acts_as_authentic/persistence_token",
33
+ "acts_as_authentic/restful_authentication",
34
+ "acts_as_authentic/session_maintenance",
35
+ "acts_as_authentic/single_access_token",
36
+ "acts_as_authentic/validations_scope",
37
+ "acts_as_authentic/base",
36
38
 
37
- "session/activation",
38
- "session/active_record_trickery",
39
- "session/brute_force_protection",
40
- "session/callbacks",
41
- "session/cookies",
42
- "session/existence",
43
- "session/foundation",
44
- "session/http_auth",
45
- "session/id",
46
- "session/klass",
47
- "session/magic_columns",
48
- "session/magic_states",
49
- "session/params",
50
- "session/password",
51
- "session/perishable_token",
52
- "session/persistence",
53
- "session/priority_record",
54
- "session/scopes",
55
- "session/session",
56
- "session/timeout",
57
- "session/unauthorized_record",
58
- "session/validation",
59
- "session/base"
39
+ "session/activation",
40
+ "session/active_record_trickery",
41
+ "session/brute_force_protection",
42
+ "session/callbacks",
43
+ "session/cookies",
44
+ "session/existence",
45
+ "session/foundation",
46
+ "session/http_auth",
47
+ "session/id",
48
+ "session/klass",
49
+ "session/magic_columns",
50
+ "session/magic_states",
51
+ "session/params",
52
+ "session/password",
53
+ "session/perishable_token",
54
+ "session/persistence",
55
+ "session/priority_record",
56
+ "session/scopes",
57
+ "session/session",
58
+ "session/timeout",
59
+ "session/unauthorized_record",
60
+ "session/validation",
61
+ "session/base"
60
62
  ].each do |library|
61
- require path + library
62
- end
63
+ require path + library
64
+ end
63
65
 
64
66
  require path + "controller_adapters/rails_adapter" if defined?(Rails)
65
67
  require path + "controller_adapters/sinatra_adapter" if defined?(Sinatra)
@@ -1,4 +1,6 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
2
4
 
3
5
  module ActsAsAuthenticTest
4
6
  class BaseTest < ActiveSupport::TestCase