binarylogic-authlogic 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == 2.1.1 released 2009-7-04
2
+
3
+ * Use mb_chars when downcasing the login string to support international characters.
4
+ * Check for the existence of the :remember_me key before setting remember_me off of a hash.
5
+ * Added check to make sure Authlogic is not loaded too late, causing a NotActivated error.
6
+
1
7
  == 2.1.0 released 2009-6-27
2
8
 
3
9
  * Fixed bug when using act_like_restful_authentication and setting passwords, needed to add a 2nd parameter to tell if to check against the database or not.
data/README.rdoc CHANGED
@@ -203,13 +203,13 @@ From rubyforge:
203
203
 
204
204
  $ sudo gem install authlogic
205
205
 
206
- OR from github:
206
+ Or from github:
207
207
 
208
208
  $ sudo gem install binarylogic-authlogic
209
209
 
210
210
  Now just add the gem dependency in your projects configuration.
211
211
 
212
- Or you install this as a plugin (for older versions of rails)
212
+ Or you can install this as a plugin:
213
213
 
214
214
  script/plugin install git://github.com/binarylogic/authlogic.git
215
215
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 1
3
3
  :major: 2
4
4
  :minor: 1
data/authlogic.gemspec ADDED
@@ -0,0 +1,205 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{authlogic}
5
+ s.version = "2.1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Ben Johnson of Binary Logic"]
9
+ s.date = %q{2009-07-04}
10
+ s.email = %q{bjohnson@binarylogic.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".gitignore",
17
+ "CHANGELOG.rdoc",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION.yml",
22
+ "authlogic.gemspec",
23
+ "generators/session/session_generator.rb",
24
+ "generators/session/templates/session.rb",
25
+ "init.rb",
26
+ "lib/authlogic.rb",
27
+ "lib/authlogic/acts_as_authentic/base.rb",
28
+ "lib/authlogic/acts_as_authentic/email.rb",
29
+ "lib/authlogic/acts_as_authentic/logged_in_status.rb",
30
+ "lib/authlogic/acts_as_authentic/login.rb",
31
+ "lib/authlogic/acts_as_authentic/magic_columns.rb",
32
+ "lib/authlogic/acts_as_authentic/password.rb",
33
+ "lib/authlogic/acts_as_authentic/perishable_token.rb",
34
+ "lib/authlogic/acts_as_authentic/persistence_token.rb",
35
+ "lib/authlogic/acts_as_authentic/restful_authentication.rb",
36
+ "lib/authlogic/acts_as_authentic/session_maintenance.rb",
37
+ "lib/authlogic/acts_as_authentic/single_access_token.rb",
38
+ "lib/authlogic/acts_as_authentic/validations_scope.rb",
39
+ "lib/authlogic/authenticates_many/association.rb",
40
+ "lib/authlogic/authenticates_many/base.rb",
41
+ "lib/authlogic/controller_adapters/abstract_adapter.rb",
42
+ "lib/authlogic/controller_adapters/merb_adapter.rb",
43
+ "lib/authlogic/controller_adapters/rails_adapter.rb",
44
+ "lib/authlogic/crypto_providers/aes256.rb",
45
+ "lib/authlogic/crypto_providers/bcrypt.rb",
46
+ "lib/authlogic/crypto_providers/md5.rb",
47
+ "lib/authlogic/crypto_providers/sha1.rb",
48
+ "lib/authlogic/crypto_providers/sha512.rb",
49
+ "lib/authlogic/i18n.rb",
50
+ "lib/authlogic/random.rb",
51
+ "lib/authlogic/regex.rb",
52
+ "lib/authlogic/session/activation.rb",
53
+ "lib/authlogic/session/active_record_trickery.rb",
54
+ "lib/authlogic/session/base.rb",
55
+ "lib/authlogic/session/brute_force_protection.rb",
56
+ "lib/authlogic/session/callbacks.rb",
57
+ "lib/authlogic/session/cookies.rb",
58
+ "lib/authlogic/session/existence.rb",
59
+ "lib/authlogic/session/foundation.rb",
60
+ "lib/authlogic/session/http_auth.rb",
61
+ "lib/authlogic/session/id.rb",
62
+ "lib/authlogic/session/klass.rb",
63
+ "lib/authlogic/session/magic_columns.rb",
64
+ "lib/authlogic/session/magic_states.rb",
65
+ "lib/authlogic/session/params.rb",
66
+ "lib/authlogic/session/password.rb",
67
+ "lib/authlogic/session/perishable_token.rb",
68
+ "lib/authlogic/session/persistence.rb",
69
+ "lib/authlogic/session/priority_record.rb",
70
+ "lib/authlogic/session/scopes.rb",
71
+ "lib/authlogic/session/session.rb",
72
+ "lib/authlogic/session/timeout.rb",
73
+ "lib/authlogic/session/unauthorized_record.rb",
74
+ "lib/authlogic/session/validation.rb",
75
+ "lib/authlogic/test_case.rb",
76
+ "lib/authlogic/test_case/mock_controller.rb",
77
+ "lib/authlogic/test_case/mock_cookie_jar.rb",
78
+ "lib/authlogic/test_case/mock_logger.rb",
79
+ "lib/authlogic/test_case/mock_request.rb",
80
+ "lib/authlogic/test_case/rails_request_adapter.rb",
81
+ "rails/init.rb",
82
+ "shoulda_macros/authlogic.rb",
83
+ "test/acts_as_authentic_test/base_test.rb",
84
+ "test/acts_as_authentic_test/email_test.rb",
85
+ "test/acts_as_authentic_test/logged_in_status_test.rb",
86
+ "test/acts_as_authentic_test/login_test.rb",
87
+ "test/acts_as_authentic_test/magic_columns_test.rb",
88
+ "test/acts_as_authentic_test/password_test.rb",
89
+ "test/acts_as_authentic_test/perishable_token_test.rb",
90
+ "test/acts_as_authentic_test/persistence_token_test.rb",
91
+ "test/acts_as_authentic_test/restful_authentication_test.rb",
92
+ "test/acts_as_authentic_test/session_maintenance_test.rb",
93
+ "test/acts_as_authentic_test/single_access_test.rb",
94
+ "test/authenticates_many_test.rb",
95
+ "test/crypto_provider_test/aes256_test.rb",
96
+ "test/crypto_provider_test/bcrypt_test.rb",
97
+ "test/crypto_provider_test/sha1_test.rb",
98
+ "test/crypto_provider_test/sha512_test.rb",
99
+ "test/fixtures/companies.yml",
100
+ "test/fixtures/employees.yml",
101
+ "test/fixtures/projects.yml",
102
+ "test/fixtures/users.yml",
103
+ "test/libs/affiliate.rb",
104
+ "test/libs/company.rb",
105
+ "test/libs/employee.rb",
106
+ "test/libs/employee_session.rb",
107
+ "test/libs/ldaper.rb",
108
+ "test/libs/ordered_hash.rb",
109
+ "test/libs/project.rb",
110
+ "test/libs/user.rb",
111
+ "test/libs/user_session.rb",
112
+ "test/random_test.rb",
113
+ "test/session_test/activation_test.rb",
114
+ "test/session_test/active_record_trickery_test.rb",
115
+ "test/session_test/brute_force_protection_test.rb",
116
+ "test/session_test/callbacks_test.rb",
117
+ "test/session_test/cookies_test.rb",
118
+ "test/session_test/credentials_test.rb",
119
+ "test/session_test/existence_test.rb",
120
+ "test/session_test/http_auth_test.rb",
121
+ "test/session_test/id_test.rb",
122
+ "test/session_test/klass_test.rb",
123
+ "test/session_test/magic_columns_test.rb",
124
+ "test/session_test/magic_states_test.rb",
125
+ "test/session_test/params_test.rb",
126
+ "test/session_test/password_test.rb",
127
+ "test/session_test/perishability_test.rb",
128
+ "test/session_test/persistence_test.rb",
129
+ "test/session_test/scopes_test.rb",
130
+ "test/session_test/session_test.rb",
131
+ "test/session_test/timeout_test.rb",
132
+ "test/session_test/unauthorized_record_test.rb",
133
+ "test/session_test/validation_test.rb",
134
+ "test/test_helper.rb"
135
+ ]
136
+ s.homepage = %q{http://github.com/binarylogic/authlogic}
137
+ s.rdoc_options = ["--charset=UTF-8"]
138
+ s.require_paths = ["lib"]
139
+ s.rubyforge_project = %q{authlogic}
140
+ s.rubygems_version = %q{1.3.4}
141
+ s.summary = %q{A clean, simple, and unobtrusive ruby authentication solution.}
142
+ s.test_files = [
143
+ "test/acts_as_authentic_test/base_test.rb",
144
+ "test/acts_as_authentic_test/email_test.rb",
145
+ "test/acts_as_authentic_test/logged_in_status_test.rb",
146
+ "test/acts_as_authentic_test/login_test.rb",
147
+ "test/acts_as_authentic_test/magic_columns_test.rb",
148
+ "test/acts_as_authentic_test/password_test.rb",
149
+ "test/acts_as_authentic_test/perishable_token_test.rb",
150
+ "test/acts_as_authentic_test/persistence_token_test.rb",
151
+ "test/acts_as_authentic_test/restful_authentication_test.rb",
152
+ "test/acts_as_authentic_test/session_maintenance_test.rb",
153
+ "test/acts_as_authentic_test/single_access_test.rb",
154
+ "test/authenticates_many_test.rb",
155
+ "test/crypto_provider_test/aes256_test.rb",
156
+ "test/crypto_provider_test/bcrypt_test.rb",
157
+ "test/crypto_provider_test/sha1_test.rb",
158
+ "test/crypto_provider_test/sha512_test.rb",
159
+ "test/libs/affiliate.rb",
160
+ "test/libs/company.rb",
161
+ "test/libs/employee.rb",
162
+ "test/libs/employee_session.rb",
163
+ "test/libs/ldaper.rb",
164
+ "test/libs/ordered_hash.rb",
165
+ "test/libs/project.rb",
166
+ "test/libs/user.rb",
167
+ "test/libs/user_session.rb",
168
+ "test/random_test.rb",
169
+ "test/session_test/activation_test.rb",
170
+ "test/session_test/active_record_trickery_test.rb",
171
+ "test/session_test/brute_force_protection_test.rb",
172
+ "test/session_test/callbacks_test.rb",
173
+ "test/session_test/cookies_test.rb",
174
+ "test/session_test/credentials_test.rb",
175
+ "test/session_test/existence_test.rb",
176
+ "test/session_test/http_auth_test.rb",
177
+ "test/session_test/id_test.rb",
178
+ "test/session_test/klass_test.rb",
179
+ "test/session_test/magic_columns_test.rb",
180
+ "test/session_test/magic_states_test.rb",
181
+ "test/session_test/params_test.rb",
182
+ "test/session_test/password_test.rb",
183
+ "test/session_test/perishability_test.rb",
184
+ "test/session_test/persistence_test.rb",
185
+ "test/session_test/scopes_test.rb",
186
+ "test/session_test/session_test.rb",
187
+ "test/session_test/timeout_test.rb",
188
+ "test/session_test/unauthorized_record_test.rb",
189
+ "test/session_test/validation_test.rb",
190
+ "test/test_helper.rb"
191
+ ]
192
+
193
+ if s.respond_to? :specification_version then
194
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
195
+ s.specification_version = 3
196
+
197
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
198
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
199
+ else
200
+ s.add_dependency(%q<activesupport>, [">= 0"])
201
+ end
202
+ else
203
+ s.add_dependency(%q<activesupport>, [">= 0"])
204
+ end
205
+ end
@@ -118,7 +118,7 @@ module Authlogic
118
118
  if sensitivity
119
119
  send("find_by_#{field}", value)
120
120
  else
121
- first(:conditions => ["LOWER(#{quoted_table_name}.#{field}) = ?", value.downcase])
121
+ first(:conditions => ["LOWER(#{quoted_table_name}.#{field}) = ?", value.mb_chars.downcase])
122
122
  end
123
123
  end
124
124
  end
@@ -3,6 +3,8 @@ module Authlogic
3
3
  # Adapts authlogic to work with rails. The point is to close the gap between what authlogic expects and what the rails controller object
4
4
  # provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc.
5
5
  class RailsAdapter < AbstractAdapter
6
+ class AuthlogicLoadedTooLateError < StandardError; end
7
+
6
8
  def authenticate_with_http_basic(&block)
7
9
  controller.authenticate_with_http_basic(&block)
8
10
  end
@@ -12,7 +14,7 @@ module Authlogic
12
14
  end
13
15
 
14
16
  def cookie_domain
15
- @cookie_domain_key ||= (Rails::VERSION::MAJOR >= 2 && Rails::VERSION::MINOR >= 3) ? :domain : :session_domain
17
+ @cookie_domain_key ||= Rails::VERSION::STRING >= '2.3' ? :domain : :session_domain
16
18
  ActionController::Base.session_options[@cookie_domain_key]
17
19
  end
18
20
 
@@ -23,9 +25,17 @@ module Authlogic
23
25
  # Lets Authlogic know about the controller object via a before filter, AKA "activates" authlogic.
24
26
  module RailsImplementation
25
27
  def self.included(klass) # :nodoc:
28
+ if defined?(::ApplicationController)
29
+ raise AuthlogicLoadedTooLateError.new("Authlogic is trying to prepend a before_filter in ActionController::Base to active itself" +
30
+ ", the problem is that ApplicationController has already been loaded meaning the before_filter won't get copied into your" +
31
+ " application. Generally this is due to another gem or plugin requiring your ApplicationController prematurely, such as" +
32
+ " the resource_controller plugin. The solution is to require Authlogic before these other gems / plugins. Please require" +
33
+ " authlogic first to get rid of this error.")
34
+ end
35
+
26
36
  klass.prepend_before_filter :activate_authlogic
27
37
  end
28
-
38
+
29
39
  private
30
40
  def activate_authlogic
31
41
  Authlogic::Session::Base.controller = RailsAdapter.new(self)
@@ -35,4 +45,4 @@ module Authlogic
35
45
  end
36
46
  end
37
47
 
38
- ActionController::Base.send(:include, Authlogic::ControllerAdapters::RailsAdapter::RailsImplementation)
48
+ ActionController::Base.send(:include, Authlogic::ControllerAdapters::RailsAdapter::RailsImplementation)
@@ -57,7 +57,7 @@ module Authlogic
57
57
  values = value.is_a?(Array) ? value : [value]
58
58
  case values.first
59
59
  when Hash
60
- self.remember_me = values.first.with_indifferent_access[:remember_me]
60
+ self.remember_me = values.first.with_indifferent_access[:remember_me] if values.first.with_indifferent_access.key?(:remember_me)
61
61
  else
62
62
  r = values.find { |value| value.is_a?(TrueClass) || value.is_a?(FalseClass) }
63
63
  self.remember_me = r if !r.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarylogic-authlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
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-06-27 00:00:00 -07:00
12
+ date: 2009-07-04 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -38,6 +38,7 @@ files:
38
38
  - README.rdoc
39
39
  - Rakefile
40
40
  - VERSION.yml
41
+ - authlogic.gemspec
41
42
  - generators/session/session_generator.rb
42
43
  - generators/session/templates/session.rb
43
44
  - init.rb