Empact-authlogic 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/.gitignore +9 -0
  2. data/CHANGELOG.rdoc +349 -0
  3. data/Empact-authlogic.gemspec +217 -0
  4. data/LICENSE +20 -0
  5. data/README.rdoc +246 -0
  6. data/Rakefile +42 -0
  7. data/VERSION.yml +5 -0
  8. data/generators/session/session_generator.rb +9 -0
  9. data/generators/session/templates/session.rb +2 -0
  10. data/init.rb +1 -0
  11. data/lib/authlogic/acts_as_authentic/base.rb +107 -0
  12. data/lib/authlogic/acts_as_authentic/email.rb +110 -0
  13. data/lib/authlogic/acts_as_authentic/logged_in_status.rb +60 -0
  14. data/lib/authlogic/acts_as_authentic/login.rb +141 -0
  15. data/lib/authlogic/acts_as_authentic/magic_columns.rb +24 -0
  16. data/lib/authlogic/acts_as_authentic/password.rb +355 -0
  17. data/lib/authlogic/acts_as_authentic/perishable_token.rb +105 -0
  18. data/lib/authlogic/acts_as_authentic/persistence_token.rb +68 -0
  19. data/lib/authlogic/acts_as_authentic/restful_authentication.rb +61 -0
  20. data/lib/authlogic/acts_as_authentic/session_maintenance.rb +139 -0
  21. data/lib/authlogic/acts_as_authentic/single_access_token.rb +65 -0
  22. data/lib/authlogic/acts_as_authentic/validations_scope.rb +32 -0
  23. data/lib/authlogic/authenticates_many/association.rb +42 -0
  24. data/lib/authlogic/authenticates_many/base.rb +55 -0
  25. data/lib/authlogic/controller_adapters/abstract_adapter.rb +67 -0
  26. data/lib/authlogic/controller_adapters/merb_adapter.rb +30 -0
  27. data/lib/authlogic/controller_adapters/rails_adapter.rb +48 -0
  28. data/lib/authlogic/controller_adapters/sinatra_adapter.rb +61 -0
  29. data/lib/authlogic/crypto_providers/aes256.rb +43 -0
  30. data/lib/authlogic/crypto_providers/bcrypt.rb +90 -0
  31. data/lib/authlogic/crypto_providers/md5.rb +34 -0
  32. data/lib/authlogic/crypto_providers/sha1.rb +35 -0
  33. data/lib/authlogic/crypto_providers/sha256.rb +50 -0
  34. data/lib/authlogic/crypto_providers/sha512.rb +50 -0
  35. data/lib/authlogic/crypto_providers/wordpress.rb +43 -0
  36. data/lib/authlogic/i18n/translator.rb +15 -0
  37. data/lib/authlogic/i18n.rb +83 -0
  38. data/lib/authlogic/random.rb +33 -0
  39. data/lib/authlogic/regex.rb +25 -0
  40. data/lib/authlogic/session/activation.rb +58 -0
  41. data/lib/authlogic/session/active_record_trickery.rb +64 -0
  42. data/lib/authlogic/session/base.rb +37 -0
  43. data/lib/authlogic/session/brute_force_protection.rb +96 -0
  44. data/lib/authlogic/session/callbacks.rb +99 -0
  45. data/lib/authlogic/session/cookies.rb +130 -0
  46. data/lib/authlogic/session/existence.rb +93 -0
  47. data/lib/authlogic/session/foundation.rb +63 -0
  48. data/lib/authlogic/session/http_auth.rb +58 -0
  49. data/lib/authlogic/session/id.rb +41 -0
  50. data/lib/authlogic/session/klass.rb +78 -0
  51. data/lib/authlogic/session/magic_columns.rb +95 -0
  52. data/lib/authlogic/session/magic_states.rb +59 -0
  53. data/lib/authlogic/session/params.rb +101 -0
  54. data/lib/authlogic/session/password.rb +240 -0
  55. data/lib/authlogic/session/perishable_token.rb +18 -0
  56. data/lib/authlogic/session/persistence.rb +70 -0
  57. data/lib/authlogic/session/priority_record.rb +34 -0
  58. data/lib/authlogic/session/scopes.rb +101 -0
  59. data/lib/authlogic/session/session.rb +62 -0
  60. data/lib/authlogic/session/timeout.rb +82 -0
  61. data/lib/authlogic/session/unauthorized_record.rb +50 -0
  62. data/lib/authlogic/session/validation.rb +82 -0
  63. data/lib/authlogic/test_case/mock_controller.rb +45 -0
  64. data/lib/authlogic/test_case/mock_cookie_jar.rb +14 -0
  65. data/lib/authlogic/test_case/mock_logger.rb +10 -0
  66. data/lib/authlogic/test_case/mock_request.rb +19 -0
  67. data/lib/authlogic/test_case/rails_request_adapter.rb +30 -0
  68. data/lib/authlogic/test_case.rb +120 -0
  69. data/lib/authlogic.rb +64 -0
  70. data/rails/init.rb +1 -0
  71. data/shoulda_macros/authlogic.rb +69 -0
  72. data/test/acts_as_authentic_test/base_test.rb +18 -0
  73. data/test/acts_as_authentic_test/email_test.rb +105 -0
  74. data/test/acts_as_authentic_test/logged_in_status_test.rb +36 -0
  75. data/test/acts_as_authentic_test/login_test.rb +109 -0
  76. data/test/acts_as_authentic_test/magic_columns_test.rb +27 -0
  77. data/test/acts_as_authentic_test/password_test.rb +236 -0
  78. data/test/acts_as_authentic_test/perishable_token_test.rb +90 -0
  79. data/test/acts_as_authentic_test/persistence_token_test.rb +55 -0
  80. data/test/acts_as_authentic_test/restful_authentication_test.rb +40 -0
  81. data/test/acts_as_authentic_test/session_maintenance_test.rb +84 -0
  82. data/test/acts_as_authentic_test/single_access_test.rb +44 -0
  83. data/test/authenticates_many_test.rb +16 -0
  84. data/test/crypto_provider_test/aes256_test.rb +14 -0
  85. data/test/crypto_provider_test/bcrypt_test.rb +14 -0
  86. data/test/crypto_provider_test/sha1_test.rb +23 -0
  87. data/test/crypto_provider_test/sha256_test.rb +14 -0
  88. data/test/crypto_provider_test/sha512_test.rb +14 -0
  89. data/test/fixtures/companies.yml +5 -0
  90. data/test/fixtures/employees.yml +17 -0
  91. data/test/fixtures/projects.yml +3 -0
  92. data/test/fixtures/users.yml +24 -0
  93. data/test/i18n_test.rb +33 -0
  94. data/test/libs/affiliate.rb +7 -0
  95. data/test/libs/company.rb +6 -0
  96. data/test/libs/employee.rb +7 -0
  97. data/test/libs/employee_session.rb +2 -0
  98. data/test/libs/ldaper.rb +3 -0
  99. data/test/libs/ordered_hash.rb +9 -0
  100. data/test/libs/project.rb +3 -0
  101. data/test/libs/user.rb +5 -0
  102. data/test/libs/user_session.rb +6 -0
  103. data/test/random_test.rb +49 -0
  104. data/test/session_test/activation_test.rb +43 -0
  105. data/test/session_test/active_record_trickery_test.rb +36 -0
  106. data/test/session_test/brute_force_protection_test.rb +101 -0
  107. data/test/session_test/callbacks_test.rb +6 -0
  108. data/test/session_test/cookies_test.rb +112 -0
  109. data/test/session_test/credentials_test.rb +0 -0
  110. data/test/session_test/existence_test.rb +64 -0
  111. data/test/session_test/http_auth_test.rb +28 -0
  112. data/test/session_test/id_test.rb +17 -0
  113. data/test/session_test/klass_test.rb +40 -0
  114. data/test/session_test/magic_columns_test.rb +62 -0
  115. data/test/session_test/magic_states_test.rb +60 -0
  116. data/test/session_test/params_test.rb +53 -0
  117. data/test/session_test/password_test.rb +106 -0
  118. data/test/session_test/perishability_test.rb +15 -0
  119. data/test/session_test/persistence_test.rb +21 -0
  120. data/test/session_test/scopes_test.rb +60 -0
  121. data/test/session_test/session_test.rb +59 -0
  122. data/test/session_test/timeout_test.rb +52 -0
  123. data/test/session_test/unauthorized_record_test.rb +13 -0
  124. data/test/session_test/validation_test.rb +23 -0
  125. data/test/test_helper.rb +182 -0
  126. metadata +248 -0
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .swp
3
+ *.log
4
+ *.sqlite3
5
+ pkg/*
6
+ coverage/*
7
+ doc/*
8
+ benchmarks/*
9
+ .specification
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,349 @@
1
+ == 2.1.3
2
+
3
+ * Accepts all valid characters for the local part of an email address
4
+
5
+ == 2.1.2
6
+
7
+ * Return the newly create object for the class level create method, instead of a boolean
8
+ * Add a model_name class method for Authlogic::Session for rails 3 compatibility. Will be using ActiveModel eventually, but this should be a quick fix.
9
+
10
+ == 2.1.1 released 2009-7-04
11
+
12
+ * Use mb_chars when downcasing the login string to support international characters.
13
+ * Check for the existence of the :remember_me key before setting remember_me off of a hash.
14
+ * Added check to make sure Authlogic is not loaded too late, causing a NotActivated error.
15
+
16
+ == 2.1.0 released 2009-6-27
17
+
18
+ * 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.
19
+ * Don't save record if they are read only.
20
+
21
+ == 2.0.14 released 2009-6-13
22
+
23
+ * Fixed issue with using brute force protection AND generalize_credentials_error_messages. Brute force protection was looking to see if there were password errors, which generalize_credentials_error_messages was obfuscating.
24
+ * Added db_setup? method to avoid errors during rake tasks where the db might not be set up. Ex: migrations
25
+ * Stop using errors.on(key) since that is now deprecated in Rails. Use errors[key] instead.
26
+ * Use valid_password? for the method name to validate a password instead of valid_#{password_field}?.
27
+
28
+ == 2.0.13 released 2009-5-13
29
+
30
+ * Add authlogic/regex.rb to manifest
31
+
32
+ == 2.0.12 released 2009-5-13
33
+
34
+ * Added the ability to add a last_request_update_allowed? method in your controller to pragmatically tell Authlogic when and when not to update the last_request_at field in your database. This only takes effect if the method if present.
35
+ * Extracted Authlogic's regular expressions into it's own module to allow easy use of them outside of Authlogic. See Authlogic::Regex for more info.
36
+ * Made being_brute_force_protected? true for the Authlogic::Session::BruteForceProtection module.
37
+ * Added the configuration option generalize_credentials_error_messages for the Authlogic::Session::Password module. This allows you to generalize your login / password errors messages as to not reveal was the problem was when authenticating. If enabled, when an invalid login is supplied it will use the same exact error message when an invalid password is supplied.
38
+ * Update email regular expression to use A-Z0-9 instead of /w as to not allow for diacritical marks in an email address.
39
+ * Changed config() convenience method to rw_config() to be more descriptive and less vague.
40
+
41
+ == 2.0.11 released 2009-4-25
42
+
43
+ * Fix bug when password is turned off and the SingleAccessToken module calls the after_password_set callback.
44
+ * HTTP basic auth can now be toggled on or off. It also checks for the existence of a standard username and password before enabling itself.
45
+ * Added option check_passwords_against_database for Authlogic::ActsAsAuthentic::Password to toggle between checking the password against the database value or the object value. Also added the same functionality to the instance method: valid_password?("password", true), where the second argument tells Authlogic to check the password against the database value. The default for this new feature is true.
46
+ * Add a maintain_sessions configuration option to Authlogic::ActsAsAuthentic::SessionMaintenance as a "clearer" option to disable automatic session maintenance.
47
+ * single_access_allowed_request_types can also be equal to :all instead of just [:all].
48
+ * Refactor params_enabled? so that the single_access_allowed? method in controllers takes precedence.
49
+ * Added testing comments in the README and expanded on the documentation in Authlogic::TestCase
50
+
51
+ == 2.0.10 released 2009-4-21
52
+
53
+ * Mock request is now transparent to non existent methods. Since the methods calls really have no functional value when testing authlogic.
54
+ * Allow password confirmation to be disabled.
55
+ * Modified login format validation to allow for the + character since emails addresses allow that as a valid character.
56
+ * Added merge_* configuration methods for acts_as_authentic to make merging options into configuration options that default to hashes. Just a few convenience methods.
57
+
58
+ == 2.0.9 released 2009-4-9
59
+
60
+ * Fixed bug where hooks provided by the password module were called when the password module was not being used due to the fact that the password field did not exist.
61
+ * Fixed bug where the find_with_login method was not being aliased if you were using an alternate field besides login.
62
+
63
+ == 2.0.8 release 2009-4-9
64
+
65
+ * Dont reset the @password_changed instance variable to false because its halts the callback chain, instead reset it to nil.
66
+
67
+ == 2.0.7 released 2009-4-9
68
+
69
+ * Rename TestCase::ControllerAdapter to TestCase::RailsRequestAdapter to help clarify it's usage and fix a constant typo.
70
+
71
+ == 2.0.6 released 2009-4-9
72
+
73
+ * Don't use second, use [1] instead so older rails versions don't complain.
74
+ * Update email regular expression to be less TLD specific: (?:[A-Z]{2,4}|museum|travel)
75
+ * Update shoulda macro for 2.0
76
+ * validates_length_of_password_confirmation_field_options defaults to validates_confirmation_of_password_field_options
77
+ * Use MockCookieJar in tests instead of a Hash in the MockController.
78
+ * Cookies now store the record id as well, for faster lookup. Also to avoid the need to use sessions since sessions are lazily loaded in rails 2.3+
79
+ * Add configuration option for Authlogic::ActsAsAuthentic: ignore_blank_passwords
80
+ * Fix cookie_domain in rails adapter
81
+ * Make password and login fields optional. This allows you to have an alternate authentication method as your main authentication source. Such as OpenID, LDAP, or whatever you want.
82
+ * Reset the @password_changed instance variable after the record has been saved.
83
+ * Add referer and user_agent to mock requests for testing purposes.
84
+ * Add :case_sensitive => false to validates_uniqueness_of calls on the login and email fields.
85
+ * MockRequest not tries to use controller.env['REMOTE_ADDR'] for the IP address in tests.
86
+ * Add in custom find_with_email and find_with_login methods to perform case insensitive searches for databases that are case sensitive by default. This is only done if the :case_insensitive option for validates_uniqueness_of_login_field_options or validates_uniqueness_of_email_field_options is set to false. Which, as of this version, it is. If you are using MySQL this has been the default behavior all along. If you are using SQLite or Postgres this has NOT been the default behavior.
87
+ * Added in exception explaining that you are using the old configuration for acts_as_authentic with an example of the new format.
88
+
89
+ == 2.0.5 released 2009-3-30
90
+
91
+ * Stub out authenticate_with_http_basic for TestCase::ControllerAdapter.
92
+ * Added second parameter for add_acts_as_authentic module to specify the position: append or prepend.
93
+
94
+ == 2.0.4 released 2009-3-28
95
+
96
+ * Added validates_uniqueness_of_login_field_options and validates_uniqueness_of_email_field_options configuration options
97
+ * Add in checks to make sure session_class is not nil.
98
+ * Cleaned up TestCase some more and added functionality to log users in during functional tests.
99
+
100
+ == 2.0.3 released 2009-3-26
101
+
102
+ * Fixed error where default session class does not exist.
103
+ * Fixed human_name for the model to use its own human name and not delegate to the associated model. Translation should be under authlogic.models.user_session (or whatever the name of your session is).
104
+ * Fixed human_attribute_name to use Authlogic keys for translation instead of ActiveRecord: authlogic.attributes.user_session.login
105
+ * For transitioning from restful_authentication, set the REST_AUTH_SITE_KEY to '' if it doesn't exist, instead of nil.
106
+ * Completely rewrote Authlogic::Testing, it's now called Authlogic::TestCase. Testing Authlogic is much easier now. Please see Authlogic::TestCase for more info.
107
+
108
+ == 2.0.2 released 2009-3-24
109
+
110
+ * Reset failed_login_count if consecutive_failed_logins_limit has been exceed and the failed_login_ban_for has passed.
111
+ * Update test helpers to use the new configuration scheme.
112
+ * Fixed issue when logging doesn't update last_request_at, so the next persistence try would fail.
113
+
114
+ == 2.0.1 released 2009-3-23
115
+
116
+ * Validate length of password.
117
+ * Dont save sessions with a ! during session maintenance.
118
+ * Add self_and_descendants_from_active_record for Rails 2.3
119
+ * Abort acts_as_authentic if there is no DB connection or table.
120
+
121
+ == 2.0.0 released 2009-3-23
122
+
123
+ * Refactored nearly all code and tests, especially acts_as_authentic. Got rid of the meta programming and rewrote to use modules and hooks. Also moved all configuration into their related modules.
124
+ * Set up a strong API with hooks to allow you to modify behavior and most importantly, easily create "add on" modules or alternate authentication methods, etc.
125
+ * Changed configuration method for acts_as_authentic to accept a block instead of a hash.
126
+ * The record attribute will NEVER be set until after validation passes, similar to how ActiveRecord executes UPDATEs and CREATEs.
127
+ * Fixed bug with session maintenance where user would log in as new user when creating another user account, typically an admin function.
128
+ * Brute force protection is only a temporary ban by default, not a permanent one.
129
+ * Switched to Hoe for gem management instead of Echoe.
130
+ * Added MD5 crypto provider for legacy systems.
131
+ * Make password salt field optional for legacy systems.
132
+
133
+ == 1.4.4 released 2009-3-2
134
+
135
+ * Moved session maintenance to a before_save, to save on queries executed and to skip an unexpected / additional save on the user object.
136
+ * Extracted random string generation into its own class and leverages SecureRandom if it is available
137
+ * Move cookies to a higher priority when trying to find the record to help with performance since Rails 3 lazily loads the sessions
138
+ * Reset perishable token in a before_save instead of a before_validation
139
+
140
+ == 1.4.3 released 2009-2-22
141
+
142
+ * Fixed issue with brute force protection.
143
+
144
+ == 1.4.2 released 2009-2-20
145
+
146
+ * Cleaned up callbacks system to use hooks and execute in the proper order.
147
+ * Added brute force protection. See the consecutive_failed_logins_limit configuration option in Authlogic::Session::Config. Also see Authlogic::Session:BruteForceProtection
148
+ * Fixed issue with calling stale? when there is no record.
149
+ * Simon Harris fixed the issue of using lock_version with the associated record and also optimized the library for better performance.
150
+ * Implemented saving the record during the callback chain to execute as few queries as possible. This way modules can hook into Authlogic, modify the associated record, and not have to worry about saving the record.
151
+
152
+ == 1.4.1 released 2009-2-8
153
+
154
+ * Fixed I18n key misspelling.
155
+ * Added I18n keys for ORM error messages.
156
+ * Use the password_field configuration value for the alias_methods defined in acts_as_authentic/credentials.rb
157
+ * Change shoulda macros implementation to follow the shoulda documentation
158
+ * Rails >2.3 uses :domain for the session option instead of :session_domain. Authlogic now uses the proper key in the rails adapter.
159
+ * Added validate_password attribute to force password validation regardless if the password is blank. This is useful for forms explicitly changing passwords.
160
+ * The class level find method will return a session object if the session is stale. The protection is that there will be no record associated with that session. This allows you to receive an object and call the stale? method on it to determine why the user must log back in.
161
+ * Added validate callbacks in Session::Base so you can run callbacks by calling validate :my_method, just like in AR.
162
+ * Checked for blank persistence tokens when trying to validate passwords, this is where transitioning occurs. People transitioning from older systems never had a persistence token, which means it would be nil here.
163
+ * Update allowed domain name extensions for email
164
+ * Ignore default length options for validations if alternate length options are provided, since AR raises an error if 2 different length specifications are provided.
165
+
166
+ == 1.4.0 released 2009-1-28
167
+
168
+ * Added support for cookie domain, based on your frameworks session domain configuration
169
+ * Updated test helper functions to use the persistence token config value
170
+ * Check for UTC times when using Time.now for current_login_at and last_request_at
171
+ * Single access now looks for a single_access_allowed? method in your controllers to determine if single access should be allowed or not. Allowing you to define exactly when single access is allowed.
172
+ * Finding the authenticated record uses klass.primary_key instead of assuming id.
173
+ * BREAKS BACKWARDS COMPATIBILITY: New I18n solution implemented. See Authlogic::I18n for more information.
174
+
175
+ == 1.3.9 released 2009-1-9
176
+
177
+ * Added the disable_perishable_token_maintenance option to disable the automatic resetting of the perishable_token, meaning you will have to maintain this yourself.
178
+ * Changed shoulda macro to conform to standards so model is not required to be passed
179
+ * Modified method definitions for the Session class to check for already defined methods, allowing you to write your own "credential" methods, and Authlogic will not overwrite your custom methods.
180
+ * Fixed bug when passing :all to single_access_allowed_request_types
181
+ * Added logout_on_timeout configuration option for Session::Base
182
+
183
+ == 1.3.8 released 2008-12-24
184
+
185
+ * Only change persistence token if the password is not blank
186
+ * Normalize the last_request_at_threshold so that you can pass an integer or a date/time range.
187
+ * Fixed bug where password length validations were not being run because the password value was not blank. It should be run if it is a new record, the password has changed, or the password is blank.
188
+ * Added disable_magic_states option for sessions, to turn off the automatic checking of "magic states" such as active?, confirmed?, and approved?.
189
+
190
+ == 1.3.7 released 2008-11-30
191
+
192
+ * Added session generator: script/generate session UserSession
193
+ * Added Test::Unit helpers file, see testing in the README
194
+
195
+ == 1.3.6 released 2008-11-30
196
+
197
+ * Modified validates_length_of for password so that there is a fallback validation if the passed "if statement" fails
198
+
199
+ == 1.3.5 released 2008-11-30
200
+
201
+ * :transition_from_crypto_provider for acts_as_authentic now accepts an array to transition from multiple providers. Which solves the problem of a double transition.
202
+ * Added AES256 as a crypto_provider option, for those that want to use a reversible encryption method by supplying a key.
203
+ * Fixed typo for using validates_format_of_options instead of validates_length_of_options
204
+ * Fixed bug when accessing the dynamic method for accessing the session record in a namespace, since it uses class_name.underscore which replaces :: with a /
205
+ * Added minimum length requirement of 4 for the password, and removed validates_presence_of for password since validates_length_of enforces this
206
+ * Set before_validation to reset the persistence token if it is blank, since a password is not required for open id authentication
207
+
208
+ == 1.3.4 released 2008-11-24
209
+
210
+ * Delegate human_attribute_name to the ActiveRecord class to take advantage of the I18n feature.
211
+ * Fixed issue with passwords from older versions of restful_authentication, the passwords end with --
212
+
213
+ == 1.3.3 released 2008-11-23
214
+
215
+ * Updated :act_like_restful_authentication for those using the older version where no site wide key is preset (REST_AUTH_SITE_KEY), Authlogic will adjust automatically based on the presence of this constant.
216
+ * Added :transition_from_crypto_provider option for acts_as_authentic to transition your user's passwords to a new algorithm.
217
+ * Added :transition_from_restful_authentication for acts_as_authentic to transition your users from restful_authentication to the Authlogic password system. Now you can choose to keep your passwords the same by using :act_like_restful_authentication, which will *NOT* do any transitioning, or you can use :transition_from_crypto_provider which will update your users passwords as they login or new accounts are created, while still allowing users with the old password system to log in.
218
+ * Modified the "interface" for the crypto providers to only provide a class level encrypt and matches? method, instead of a class level encrypt and decrypt method.
219
+
220
+ == 1.3.2 released 2008-11-22
221
+
222
+ * Updated code to work better with BCrypt, using root level class now.
223
+
224
+ == 1.3.1 released 2008-11-22
225
+
226
+ * Fixed typo in acts_as_authentic config when passing the :scope option.
227
+ * Added :act_like_restful_authentication option for acts_as_authentic
228
+ * Added a new crypto provider: BCrypt, this is for those storing the nuclear launch codes in their apps
229
+
230
+ == 1.3.0 released 2008-11-21
231
+
232
+ * BREAKS BACKWARDS COMPATIBILITY: changed the confirm_password field to password_confirmation for acts_as_authentic, since the rails validates_confirmation_of handles creating this attribute and there is no option to change the name of this.
233
+ * BREAKS BACKWARDS COMPATIBILITY: Cleaned up all of the validation configuration for acts_as_authentic, as well as the documentation that goes with it, you can accomplish the same things as before, but this is much more flexible and much more organized. This is mainly for those implementing i18n support. Instead of :whatever_message, its now :login_field_validates_length_of_options => {:message => "your i18n friendly message"}. As a side note, with the new i18n support in rails I would not be surprised if this is already done for you since Authlogic uses the ActiveRecord validation methods.
234
+ * Got rid of simple delegator for the abstract controller, apparently this has performance issues.
235
+ * Cleaned up validations to assume ActiveRecord dirty attributes are present, I think this is a safe assumption.
236
+
237
+ == 1.2.2 released 2008-11-20
238
+
239
+ * Added allow_blank_login_and_password_field and allow_blank_email_field options to acts_as_authentic, which allows you to have alternative logins, such as OpenID
240
+ * In the session Authlogic now also stores the record id. We use this id to find the record and then check the token against the record, thus allowing for quicker database lookups, while getting the same security.
241
+ * Skip validation for reset_perishable_token!
242
+ * Added checks for uniqueness validations to only perform if the values have changed, this cuts down on DB queries
243
+ * Abstract controller adapter now uses ruby's simple delegator class
244
+ * Allow to save with a block: user_session.save { |result| }, result will either be false or self, this is useful when implementing OpenID and other methods
245
+
246
+ == 1.2.1 released 2008-11-19
247
+
248
+ * Added build method to authenticates_many association to act like AR association collections.
249
+ * Added validation boolean configuration options for acts_as_authentic: validate_field, validate_login_field, validate_password_field, validate_email_field. This turns on and off validations for their respective fields.
250
+ * Renamed all password_reset_token terms to perishable_token, including configuration, etc. I still allow for the old configurations so this will not break compatibility, but perishable token is a better name and can be used for account confirmation as well as a password reset token, or anything else you want.
251
+ * Renamed all remember_token instances to persistence_token, the term "remember token" doesn't really make sense. I still allow for the old configuration, so this will not break backwards compatibility: persistence_token fits better and makes more sense.
252
+
253
+ == 1.2.0 released 2008-11-16
254
+
255
+ * Added check for database set up in acts_as_authentic to prevent errors during migrations.
256
+ * Forced logged_in and logged_out named scopes to use seconds.
257
+ * Hardened valid_password? method to only allow raw passwords.
258
+ * controllers and scopes are no longer stored in class variables but in the Thread.current hash so their instances die out with the thread, which frees up memory.
259
+ * Removed single_access_token_field and remember_token_field from Sesson::Config, they are not needed there.
260
+ * Added password_reset_token to assist in resetting passwords.
261
+ * Added email_field, email_field_regex, email_field_regex_failed_message configuration options to acts_as_authentic. So that you can validate emails as well as a login, instead of the either-or approach.
262
+ * Added configuration for all validation messages for the session so that you can modify them and provide I18n support.
263
+
264
+ == 1.1.1 released 2008-11-13
265
+
266
+ * Removed ActiveRecord dependency.
267
+ * Removed loading shoulda macros by default, moved to shoulda_macros dir.
268
+ * Modified how params access works. Added in single_access_token_field which params now uses. See the single access section in the README. Various configuration options added as well.
269
+ * Cleaned up acts_as_authentic configuration, added new config module to do this.
270
+ * Cleaned up acts_as_authentic tests
271
+ * Moved acts_as_authentic sub modules into the proper name spaces
272
+
273
+ == 1.1.0 released 2008-11-13
274
+
275
+ * Moved Rack standards into abstract_adapter for the controllers.
276
+ * Added authenticating_with_credentials?, authenticating_with_unauthorized_record?
277
+ * Fixed typo in abstract_adapter, black to block.
278
+ * Cleaned up / reorganized tests.
279
+ * Moved ActiveRecord additions to ORM Adapters name space to make way for Data Mapper.
280
+ * Reorganized and modified acts_as_authentic to be free standing and not get info from the related session.
281
+ * The session now gets its configuration from the model, since determining which fields are present is ORM specific.
282
+ * Extracted session and cookie logic into their own modules for Session.
283
+ * Moved crypto providers into their own module and added a Sha1 provider to help with the restful_authentication transition.
284
+ * Allow the unique_token method to use the alternate crypto_provider if it is a hash algorithm, otherwise default to Sha512.
285
+ * Added last_request_at_threshold configuration option.
286
+ * Changed Scoped class to AuthenticatesManyAssociation, like AR has HasManyAssociation, etc.
287
+ * Added should_be_authentic shoulda macro.
288
+ * Removed some magic from how sessions are initialized. See the initialize documentation, this method is a little more structured now, which was required for adding in openid.
289
+ * Added in logging via a params token, which is friendly for feed URLs. Works just like cookies and sessions when persisting the session.
290
+ * Added the option to use session.user, instead of session.record. This is based off of what model your session is authenticating with.
291
+
292
+ == 1.0.0 released 2008-11-05
293
+
294
+ * Checked for blank login counts, if a default wasnt set in the migrations.
295
+ * Added check for database table in acts_as_authentic to avoid errors in initial setup.
296
+ * Completely rewrote tests to be more conventional and thorough tests, removed test_app.
297
+ * Modified how validations work so that a validate method was added as well as callbacks for that method.
298
+ * Extracted scope support into its own module to help organize code better.
299
+ * Added in salt for encryption, just like hashes and removed :crypto_provider_type option for acts_as_authentic.
300
+ * Added merb adapters.
301
+ * Improved documentation throughout.
302
+
303
+ == 0.10.4 released 2008-10-31
304
+
305
+ * Changed configuration to use inheritable attributes
306
+ * Cleaned up requires to be in their proper files
307
+ * Added in scope support.
308
+
309
+ == 0.10.3 released 2008-10-31
310
+
311
+ * Instead of raising an error when extra fields are passed in credentials=, just ignore them.
312
+ * Added remember_me config option to set the default value.
313
+ * Only call credential methods if an argument was passed.
314
+ * More unit tests
315
+ * Hardened automatic session updating. Also automatically log the user in if they change their password when logged out.
316
+
317
+ == 0.10.2 released 2008-10-24
318
+
319
+ * Added in stretches to the default Sha512 encryption algorithm.
320
+ * Use column_names instead of columns when determining if a column is present.
321
+ * Improved validation callbacks. after_validation should only be run if valid? = true. Also clear errors before the "before_validation" callback.
322
+
323
+ == 0.10.1 released 2008-10-24
324
+
325
+ * Sessions now store the "remember token" instead of the id. This is much safer and guarantees all "sessions" that are logged in are logged in with a valid password. This way stale sessions can't be persisted.
326
+ * Bumped security to Sha512 from Sha256.
327
+ * Remove attr_protected call in acts_as_authentic
328
+ * protected_password should use pasword_field configuration value
329
+ * changed magic state "inactive" to "active"
330
+
331
+ == 0.10.0 released 2008-10-24
332
+
333
+ * Do not allow instantiation if the session has not been activated with a controller object. Just like ActiveRecord won't let you do anything without a DB connection.
334
+ * Abstracted controller implementation to allow for rails, merb, etc adapters. So this is not confined to the rails framework.
335
+ * Removed create and update methods and added save, like ActiveRecord.
336
+ * after_validation should be able to change the result if it adds errors on callbacks.
337
+ * Completed tests.
338
+
339
+ == 0.9.1 released 2008-10-24
340
+
341
+ * Changed scope to id. Makes more sense to call it an id and fits better with the ActiveRecord model.
342
+ * Removed saving_from_session flag, apparently it is not needed.
343
+ * Fixed updating sessions to make more sense and be stricter.
344
+ * change last_click_at to last_request_at
345
+ * Only run "after" callbacks if the result is successful.
346
+
347
+ == 0.9.0 released 2008-10-24
348
+
349
+ * Initial release.
@@ -0,0 +1,217 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{Empact-authlogic}
8
+ s.version = "2.1.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Johnson of Binary Logic", "Ben Woosley"]
12
+ s.date = %q{2010-04-15}
13
+ s.email = %q{bjohnson@binarylogic.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG.rdoc",
21
+ "Empact-authlogic.gemspec",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION.yml",
26
+ "generators/session/session_generator.rb",
27
+ "generators/session/templates/session.rb",
28
+ "init.rb",
29
+ "lib/authlogic.rb",
30
+ "lib/authlogic/acts_as_authentic/base.rb",
31
+ "lib/authlogic/acts_as_authentic/email.rb",
32
+ "lib/authlogic/acts_as_authentic/logged_in_status.rb",
33
+ "lib/authlogic/acts_as_authentic/login.rb",
34
+ "lib/authlogic/acts_as_authentic/magic_columns.rb",
35
+ "lib/authlogic/acts_as_authentic/password.rb",
36
+ "lib/authlogic/acts_as_authentic/perishable_token.rb",
37
+ "lib/authlogic/acts_as_authentic/persistence_token.rb",
38
+ "lib/authlogic/acts_as_authentic/restful_authentication.rb",
39
+ "lib/authlogic/acts_as_authentic/session_maintenance.rb",
40
+ "lib/authlogic/acts_as_authentic/single_access_token.rb",
41
+ "lib/authlogic/acts_as_authentic/validations_scope.rb",
42
+ "lib/authlogic/authenticates_many/association.rb",
43
+ "lib/authlogic/authenticates_many/base.rb",
44
+ "lib/authlogic/controller_adapters/abstract_adapter.rb",
45
+ "lib/authlogic/controller_adapters/merb_adapter.rb",
46
+ "lib/authlogic/controller_adapters/rails_adapter.rb",
47
+ "lib/authlogic/controller_adapters/sinatra_adapter.rb",
48
+ "lib/authlogic/crypto_providers/aes256.rb",
49
+ "lib/authlogic/crypto_providers/bcrypt.rb",
50
+ "lib/authlogic/crypto_providers/md5.rb",
51
+ "lib/authlogic/crypto_providers/sha1.rb",
52
+ "lib/authlogic/crypto_providers/sha256.rb",
53
+ "lib/authlogic/crypto_providers/sha512.rb",
54
+ "lib/authlogic/crypto_providers/wordpress.rb",
55
+ "lib/authlogic/i18n.rb",
56
+ "lib/authlogic/i18n/translator.rb",
57
+ "lib/authlogic/random.rb",
58
+ "lib/authlogic/regex.rb",
59
+ "lib/authlogic/session/activation.rb",
60
+ "lib/authlogic/session/active_record_trickery.rb",
61
+ "lib/authlogic/session/base.rb",
62
+ "lib/authlogic/session/brute_force_protection.rb",
63
+ "lib/authlogic/session/callbacks.rb",
64
+ "lib/authlogic/session/cookies.rb",
65
+ "lib/authlogic/session/existence.rb",
66
+ "lib/authlogic/session/foundation.rb",
67
+ "lib/authlogic/session/http_auth.rb",
68
+ "lib/authlogic/session/id.rb",
69
+ "lib/authlogic/session/klass.rb",
70
+ "lib/authlogic/session/magic_columns.rb",
71
+ "lib/authlogic/session/magic_states.rb",
72
+ "lib/authlogic/session/params.rb",
73
+ "lib/authlogic/session/password.rb",
74
+ "lib/authlogic/session/perishable_token.rb",
75
+ "lib/authlogic/session/persistence.rb",
76
+ "lib/authlogic/session/priority_record.rb",
77
+ "lib/authlogic/session/scopes.rb",
78
+ "lib/authlogic/session/session.rb",
79
+ "lib/authlogic/session/timeout.rb",
80
+ "lib/authlogic/session/unauthorized_record.rb",
81
+ "lib/authlogic/session/validation.rb",
82
+ "lib/authlogic/test_case.rb",
83
+ "lib/authlogic/test_case/mock_controller.rb",
84
+ "lib/authlogic/test_case/mock_cookie_jar.rb",
85
+ "lib/authlogic/test_case/mock_logger.rb",
86
+ "lib/authlogic/test_case/mock_request.rb",
87
+ "lib/authlogic/test_case/rails_request_adapter.rb",
88
+ "rails/init.rb",
89
+ "shoulda_macros/authlogic.rb",
90
+ "test/acts_as_authentic_test/base_test.rb",
91
+ "test/acts_as_authentic_test/email_test.rb",
92
+ "test/acts_as_authentic_test/logged_in_status_test.rb",
93
+ "test/acts_as_authentic_test/login_test.rb",
94
+ "test/acts_as_authentic_test/magic_columns_test.rb",
95
+ "test/acts_as_authentic_test/password_test.rb",
96
+ "test/acts_as_authentic_test/perishable_token_test.rb",
97
+ "test/acts_as_authentic_test/persistence_token_test.rb",
98
+ "test/acts_as_authentic_test/restful_authentication_test.rb",
99
+ "test/acts_as_authentic_test/session_maintenance_test.rb",
100
+ "test/acts_as_authentic_test/single_access_test.rb",
101
+ "test/authenticates_many_test.rb",
102
+ "test/crypto_provider_test/aes256_test.rb",
103
+ "test/crypto_provider_test/bcrypt_test.rb",
104
+ "test/crypto_provider_test/sha1_test.rb",
105
+ "test/crypto_provider_test/sha256_test.rb",
106
+ "test/crypto_provider_test/sha512_test.rb",
107
+ "test/fixtures/companies.yml",
108
+ "test/fixtures/employees.yml",
109
+ "test/fixtures/projects.yml",
110
+ "test/fixtures/users.yml",
111
+ "test/i18n_test.rb",
112
+ "test/libs/affiliate.rb",
113
+ "test/libs/company.rb",
114
+ "test/libs/employee.rb",
115
+ "test/libs/employee_session.rb",
116
+ "test/libs/ldaper.rb",
117
+ "test/libs/ordered_hash.rb",
118
+ "test/libs/project.rb",
119
+ "test/libs/user.rb",
120
+ "test/libs/user_session.rb",
121
+ "test/random_test.rb",
122
+ "test/session_test/activation_test.rb",
123
+ "test/session_test/active_record_trickery_test.rb",
124
+ "test/session_test/brute_force_protection_test.rb",
125
+ "test/session_test/callbacks_test.rb",
126
+ "test/session_test/cookies_test.rb",
127
+ "test/session_test/credentials_test.rb",
128
+ "test/session_test/existence_test.rb",
129
+ "test/session_test/http_auth_test.rb",
130
+ "test/session_test/id_test.rb",
131
+ "test/session_test/klass_test.rb",
132
+ "test/session_test/magic_columns_test.rb",
133
+ "test/session_test/magic_states_test.rb",
134
+ "test/session_test/params_test.rb",
135
+ "test/session_test/password_test.rb",
136
+ "test/session_test/perishability_test.rb",
137
+ "test/session_test/persistence_test.rb",
138
+ "test/session_test/scopes_test.rb",
139
+ "test/session_test/session_test.rb",
140
+ "test/session_test/timeout_test.rb",
141
+ "test/session_test/unauthorized_record_test.rb",
142
+ "test/session_test/validation_test.rb",
143
+ "test/test_helper.rb"
144
+ ]
145
+ s.homepage = %q{http://github.com/binarylogic/authlogic}
146
+ s.rdoc_options = ["--charset=UTF-8"]
147
+ s.require_paths = ["lib"]
148
+ s.rubyforge_project = %q{authlogic}
149
+ s.rubygems_version = %q{1.3.6}
150
+ s.summary = %q{A clean, simple, and unobtrusive ruby authentication solution.}
151
+ s.test_files = [
152
+ "test/acts_as_authentic_test/base_test.rb",
153
+ "test/acts_as_authentic_test/email_test.rb",
154
+ "test/acts_as_authentic_test/logged_in_status_test.rb",
155
+ "test/acts_as_authentic_test/login_test.rb",
156
+ "test/acts_as_authentic_test/magic_columns_test.rb",
157
+ "test/acts_as_authentic_test/password_test.rb",
158
+ "test/acts_as_authentic_test/perishable_token_test.rb",
159
+ "test/acts_as_authentic_test/persistence_token_test.rb",
160
+ "test/acts_as_authentic_test/restful_authentication_test.rb",
161
+ "test/acts_as_authentic_test/session_maintenance_test.rb",
162
+ "test/acts_as_authentic_test/single_access_test.rb",
163
+ "test/authenticates_many_test.rb",
164
+ "test/crypto_provider_test/aes256_test.rb",
165
+ "test/crypto_provider_test/bcrypt_test.rb",
166
+ "test/crypto_provider_test/sha1_test.rb",
167
+ "test/crypto_provider_test/sha256_test.rb",
168
+ "test/crypto_provider_test/sha512_test.rb",
169
+ "test/i18n_test.rb",
170
+ "test/libs/affiliate.rb",
171
+ "test/libs/company.rb",
172
+ "test/libs/employee.rb",
173
+ "test/libs/employee_session.rb",
174
+ "test/libs/ldaper.rb",
175
+ "test/libs/ordered_hash.rb",
176
+ "test/libs/project.rb",
177
+ "test/libs/user.rb",
178
+ "test/libs/user_session.rb",
179
+ "test/random_test.rb",
180
+ "test/session_test/activation_test.rb",
181
+ "test/session_test/active_record_trickery_test.rb",
182
+ "test/session_test/brute_force_protection_test.rb",
183
+ "test/session_test/callbacks_test.rb",
184
+ "test/session_test/cookies_test.rb",
185
+ "test/session_test/credentials_test.rb",
186
+ "test/session_test/existence_test.rb",
187
+ "test/session_test/http_auth_test.rb",
188
+ "test/session_test/id_test.rb",
189
+ "test/session_test/klass_test.rb",
190
+ "test/session_test/magic_columns_test.rb",
191
+ "test/session_test/magic_states_test.rb",
192
+ "test/session_test/params_test.rb",
193
+ "test/session_test/password_test.rb",
194
+ "test/session_test/perishability_test.rb",
195
+ "test/session_test/persistence_test.rb",
196
+ "test/session_test/scopes_test.rb",
197
+ "test/session_test/session_test.rb",
198
+ "test/session_test/timeout_test.rb",
199
+ "test/session_test/unauthorized_record_test.rb",
200
+ "test/session_test/validation_test.rb",
201
+ "test/test_helper.rb"
202
+ ]
203
+
204
+ if s.respond_to? :specification_version then
205
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
206
+ s.specification_version = 3
207
+
208
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
209
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
210
+ else
211
+ s.add_dependency(%q<activesupport>, [">= 0"])
212
+ end
213
+ else
214
+ s.add_dependency(%q<activesupport>, [">= 0"])
215
+ end
216
+ end
217
+
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ben Johnson of Binary Logic
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.