authlogic 1.4.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of authlogic might be problematic. Click here for more details.

Files changed (131) hide show
  1. data/CHANGELOG.rdoc +19 -0
  2. data/Manifest.txt +111 -0
  3. data/README.rdoc +116 -389
  4. data/Rakefile +14 -7
  5. data/lib/authlogic.rb +33 -35
  6. data/lib/authlogic/acts_as_authentic/base.rb +91 -0
  7. data/lib/authlogic/acts_as_authentic/email.rb +77 -0
  8. data/lib/authlogic/acts_as_authentic/logged_in_status.rb +54 -0
  9. data/lib/authlogic/acts_as_authentic/login.rb +65 -0
  10. data/lib/authlogic/acts_as_authentic/magic_columns.rb +24 -0
  11. data/lib/authlogic/acts_as_authentic/password.rb +215 -0
  12. data/lib/authlogic/acts_as_authentic/perishable_token.rb +100 -0
  13. data/lib/authlogic/acts_as_authentic/persistence_token.rb +66 -0
  14. data/lib/authlogic/acts_as_authentic/restful_authentication.rb +60 -0
  15. data/lib/authlogic/acts_as_authentic/session_maintenance.rb +127 -0
  16. data/lib/authlogic/acts_as_authentic/single_access_token.rb +58 -0
  17. data/lib/authlogic/acts_as_authentic/validations_scope.rb +32 -0
  18. data/lib/authlogic/{session/authenticates_many_association.rb → authenticates_many/association.rb} +10 -6
  19. data/lib/authlogic/authenticates_many/base.rb +55 -0
  20. data/lib/authlogic/controller_adapters/abstract_adapter.rb +2 -3
  21. data/lib/authlogic/controller_adapters/merb_adapter.rb +0 -4
  22. data/lib/authlogic/controller_adapters/rails_adapter.rb +0 -4
  23. data/lib/authlogic/crypto_providers/aes256.rb +0 -2
  24. data/lib/authlogic/crypto_providers/bcrypt.rb +0 -2
  25. data/lib/authlogic/crypto_providers/md5.rb +34 -0
  26. data/lib/authlogic/crypto_providers/sha1.rb +0 -2
  27. data/lib/authlogic/crypto_providers/sha512.rb +1 -3
  28. data/lib/authlogic/i18n.rb +1 -4
  29. data/lib/authlogic/random.rb +33 -0
  30. data/lib/authlogic/session/activation.rb +56 -0
  31. data/lib/authlogic/session/active_record_trickery.rb +15 -7
  32. data/lib/authlogic/session/base.rb +31 -456
  33. data/lib/authlogic/session/brute_force_protection.rb +50 -27
  34. data/lib/authlogic/session/callbacks.rb +24 -15
  35. data/lib/authlogic/session/cookies.rb +108 -22
  36. data/lib/authlogic/session/existence.rb +89 -0
  37. data/lib/authlogic/session/foundation.rb +63 -0
  38. data/lib/authlogic/session/http_auth.rb +23 -0
  39. data/lib/authlogic/session/id.rb +41 -0
  40. data/lib/authlogic/session/klass.rb +75 -0
  41. data/lib/authlogic/session/magic_columns.rb +75 -0
  42. data/lib/authlogic/session/magic_states.rb +58 -0
  43. data/lib/authlogic/session/params.rb +82 -19
  44. data/lib/authlogic/session/password.rb +156 -0
  45. data/lib/authlogic/session/{perishability.rb → perishable_token.rb} +4 -4
  46. data/lib/authlogic/session/persistence.rb +70 -0
  47. data/lib/authlogic/session/priority_record.rb +34 -0
  48. data/lib/authlogic/session/scopes.rb +57 -53
  49. data/lib/authlogic/session/session.rb +46 -31
  50. data/lib/authlogic/session/timeout.rb +65 -31
  51. data/lib/authlogic/session/unauthorized_record.rb +50 -0
  52. data/lib/authlogic/session/validation.rb +76 -0
  53. data/lib/authlogic/testing/test_unit_helpers.rb +3 -3
  54. data/lib/authlogic/version.rb +3 -3
  55. data/test/acts_as_authentic_test/base_test.rb +12 -0
  56. data/test/acts_as_authentic_test/email_test.rb +79 -0
  57. data/test/acts_as_authentic_test/logged_in_status_test.rb +36 -0
  58. data/test/acts_as_authentic_test/login_test.rb +79 -0
  59. data/test/acts_as_authentic_test/magic_columns_test.rb +27 -0
  60. data/test/acts_as_authentic_test/password_test.rb +212 -0
  61. data/test/acts_as_authentic_test/perishable_token_test.rb +56 -0
  62. data/test/acts_as_authentic_test/persistence_token_test.rb +55 -0
  63. data/test/acts_as_authentic_test/session_maintenance_test.rb +68 -0
  64. data/test/acts_as_authentic_test/single_access_test.rb +39 -0
  65. data/test/authenticates_many_test.rb +16 -0
  66. data/test/{crypto_provider_tests → crypto_provider_test}/aes256_test.rb +1 -1
  67. data/test/{crypto_provider_tests → crypto_provider_test}/bcrypt_test.rb +1 -1
  68. data/test/{crypto_provider_tests → crypto_provider_test}/sha1_test.rb +1 -1
  69. data/test/{crypto_provider_tests → crypto_provider_test}/sha512_test.rb +1 -1
  70. data/test/fixtures/employees.yml +4 -4
  71. data/test/fixtures/users.yml +6 -6
  72. data/test/libs/company.rb +6 -0
  73. data/test/libs/employee.rb +7 -0
  74. data/test/libs/employee_session.rb +2 -0
  75. data/test/libs/project.rb +3 -0
  76. data/test/libs/user_session.rb +2 -0
  77. data/test/random_test.rb +49 -0
  78. data/test/session_test/activation_test.rb +43 -0
  79. data/test/session_test/active_record_trickery_test.rb +26 -0
  80. data/test/session_test/brute_force_protection_test.rb +76 -0
  81. data/test/session_test/callbacks_test.rb +6 -0
  82. data/test/session_test/cookies_test.rb +107 -0
  83. data/test/session_test/credentials_test.rb +0 -0
  84. data/test/session_test/existence_test.rb +64 -0
  85. data/test/session_test/http_auth_test.rb +16 -0
  86. data/test/session_test/id_test.rb +17 -0
  87. data/test/session_test/klass_test.rb +35 -0
  88. data/test/session_test/magic_columns_test.rb +59 -0
  89. data/test/session_test/magic_states_test.rb +60 -0
  90. data/test/session_test/params_test.rb +53 -0
  91. data/test/session_test/password_test.rb +84 -0
  92. data/test/{session_tests → session_test}/perishability_test.rb +1 -1
  93. data/test/session_test/persistence_test.rb +21 -0
  94. data/test/{session_tests → session_test}/scopes_test.rb +2 -3
  95. data/test/session_test/session_test.rb +59 -0
  96. data/test/session_test/timeout_test.rb +43 -0
  97. data/test/session_test/unauthorized_record_test.rb +13 -0
  98. data/test/session_test/validation_test.rb +23 -0
  99. data/test/test_helper.rb +14 -29
  100. metadata +120 -112
  101. data/Manifest +0 -76
  102. data/authlogic.gemspec +0 -38
  103. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/base.rb +0 -22
  104. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/config.rb +0 -238
  105. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/credentials.rb +0 -155
  106. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/logged_in.rb +0 -51
  107. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/perishability.rb +0 -71
  108. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/persistence.rb +0 -94
  109. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/session_maintenance.rb +0 -87
  110. data/lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/single_access.rb +0 -61
  111. data/lib/authlogic/orm_adapters/active_record_adapter/authenticates_many.rb +0 -58
  112. data/lib/authlogic/session/config.rb +0 -421
  113. data/lib/authlogic/session/errors.rb +0 -18
  114. data/lib/authlogic/session/record_info.rb +0 -24
  115. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/config_test.rb +0 -154
  116. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/credentials_test.rb +0 -157
  117. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/logged_in_test.rb +0 -24
  118. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/perishability_test.rb +0 -41
  119. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/persistence_test.rb +0 -54
  120. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/session_maintenance_test.rb +0 -62
  121. data/test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb +0 -41
  122. data/test/orm_adapters_tests/active_record_adapter_tests/authenticates_many_test.rb +0 -32
  123. data/test/session_tests/active_record_trickery_test.rb +0 -14
  124. data/test/session_tests/authenticates_many_association_test.rb +0 -28
  125. data/test/session_tests/base_test.rb +0 -307
  126. data/test/session_tests/brute_force_protection_test.rb +0 -53
  127. data/test/session_tests/config_test.rb +0 -184
  128. data/test/session_tests/cookies_test.rb +0 -32
  129. data/test/session_tests/params_test.rb +0 -32
  130. data/test/session_tests/session_test.rb +0 -45
  131. data/test/session_tests/timeout_test.rb +0 -71
@@ -0,0 +1,53 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ module ParamsTest
5
+ class ConfigTest < ActiveSupport::TestCase
6
+ def test_params_key
7
+ UserSession.params_key = "my_params_key"
8
+ assert_equal "my_params_key", UserSession.params_key
9
+
10
+ UserSession.params_key "user_credentials"
11
+ assert_equal "user_credentials", UserSession.params_key
12
+ end
13
+
14
+ def test_single_access_allowed_request_types
15
+ UserSession.single_access_allowed_request_types = ["my request type"]
16
+ assert_equal ["my request type"], UserSession.single_access_allowed_request_types
17
+
18
+ UserSession.single_access_allowed_request_types ["application/rss+xml", "application/atom+xml"]
19
+ assert_equal ["application/rss+xml", "application/atom+xml"], UserSession.single_access_allowed_request_types
20
+ end
21
+ end
22
+
23
+ class InstanceMethodsTest < ActiveSupport::TestCase
24
+ def test_persist_persist_by_params
25
+ ben = users(:ben)
26
+ session = UserSession.new
27
+
28
+ assert !session.persisting?
29
+ set_params_for(ben)
30
+
31
+ assert !session.persisting?
32
+ assert !session.unauthorized_record
33
+ assert !session.record
34
+ assert_nil @controller.session["user_credentials"]
35
+
36
+ set_request_content_type("text/plain")
37
+ assert !session.persisting?
38
+ assert !session.unauthorized_record
39
+ assert_nil @controller.session["user_credentials"]
40
+
41
+ set_request_content_type("application/atom+xml")
42
+ assert session.persisting?
43
+ assert_equal ben, session.record
44
+ assert_nil @controller.session["user_credentials"] # should not persist since this is single access
45
+
46
+ set_request_content_type("application/rss+xml")
47
+ assert session.persisting?
48
+ assert_equal ben, session.unauthorized_record
49
+ assert_nil @controller.session["user_credentials"]
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,84 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ module PasswordTest
5
+ class ConfigTest < ActiveSupport::TestCase
6
+ def test_find_by_login_method
7
+ UserSession.find_by_login_method = "my_login_method"
8
+ assert_equal "my_login_method", UserSession.find_by_login_method
9
+
10
+ UserSession.find_by_login_method "find_by_login"
11
+ assert_equal "find_by_login", UserSession.find_by_login_method
12
+ end
13
+
14
+ def test_verify_password_method
15
+ UserSession.verify_password_method = "my_login_method"
16
+ assert_equal "my_login_method", UserSession.verify_password_method
17
+
18
+ UserSession.verify_password_method "valid_password?"
19
+ assert_equal "valid_password?", UserSession.verify_password_method
20
+ end
21
+
22
+ def test_login_field
23
+ UserSession.configured_password_methods = false
24
+ UserSession.login_field = :saweet
25
+ assert_equal :saweet, UserSession.login_field
26
+ session = UserSession.new
27
+ assert session.respond_to?(:saweet)
28
+
29
+ UserSession.login_field :login
30
+ assert_equal :login, UserSession.login_field
31
+ session = UserSession.new
32
+ assert session.respond_to?(:login)
33
+ end
34
+
35
+ def test_password_field
36
+ UserSession.configured_password_methods = false
37
+ UserSession.password_field = :saweet
38
+ assert_equal :saweet, UserSession.password_field
39
+ session = UserSession.new
40
+ assert session.respond_to?(:saweet)
41
+
42
+ UserSession.password_field :password
43
+ assert_equal :password, UserSession.password_field
44
+ session = UserSession.new
45
+ assert session.respond_to?(:password)
46
+ end
47
+ end
48
+
49
+ class InstanceMethodsTest < ActiveSupport::TestCase
50
+ def test_init
51
+ session = UserSession.new
52
+ assert session.respond_to?(:login)
53
+ assert session.respond_to?(:login=)
54
+ assert session.respond_to?(:password)
55
+ assert session.respond_to?(:password=)
56
+ assert session.respond_to?(:protected_password, true)
57
+ end
58
+
59
+ def test_credentials
60
+ session = UserSession.new
61
+ session.credentials = {:login => "login", :password => "pass"}
62
+ assert_equal "login", session.login
63
+ assert_nil session.password
64
+ assert_equal "pass", session.send(:protected_password)
65
+ assert_equal({:password => "<protected>", :login => "login"}, session.credentials)
66
+ end
67
+
68
+ def test_credentials_are_params_safe
69
+ session = UserSession.new
70
+ assert_nothing_raised { session.credentials = {:hacker_method => "error!"} }
71
+ end
72
+
73
+ def test_save_with_credentials
74
+ ben = users(:ben)
75
+ session = UserSession.new(:login => ben.login, :password => "benrocks")
76
+ assert session.save
77
+ assert !session.new_session?
78
+ assert_equal 1, session.record.login_count
79
+ assert Time.now >= session.record.current_login_at
80
+ assert_equal "1.1.1.1", session.record.current_login_ip
81
+ end
82
+ end
83
+ end
84
+ end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper.rb'
2
2
 
3
- module SessionTests
3
+ module SessionTest
4
4
  class PerishabilityTest < ActiveSupport::TestCase
5
5
  def test_after_save
6
6
  ben = users(:ben)
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ class PersistenceTest < ActiveSupport::TestCase
5
+ def test_find
6
+ ben = users(:ben)
7
+ assert !UserSession.find
8
+ http_basic_auth_for(ben) { assert UserSession.find }
9
+ set_cookie_for(ben)
10
+ assert UserSession.find
11
+ unset_cookie
12
+ set_session_for(ben)
13
+ session = UserSession.find
14
+ assert session
15
+ end
16
+
17
+ def test_persisting
18
+ # tested thoroughly in test_find
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper.rb'
2
2
 
3
- module SessionTests
3
+ module SessionTest
4
4
  class ScopesTest < ActiveSupport::TestCase
5
5
  def test_scope_method
6
6
  assert_nil Authlogic::Session::Base.scope
@@ -39,8 +39,7 @@ module SessionTests
39
39
  session = UserSession.new
40
40
  assert_equal({:find_options => {:conditions => "awesome = 1"}, :id => "some_id"}, session.scope)
41
41
  session.id = :another_id
42
- assert_equal "another_id_some_id_user_credentials", session.cookie_key
43
- assert_equal "another_id_some_id_user_credentials", session.session_key
42
+ assert_equal "another_id_some_id_test", session.send(:build_key, "test")
44
43
  end
45
44
  end
46
45
 
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ module SessionTest
5
+ class ConfigTest < ActiveSupport::TestCase
6
+ def test_session_key
7
+ UserSession.session_key = "my_session_key"
8
+ assert_equal "my_session_key", UserSession.session_key
9
+
10
+ UserSession.session_key "user_credentials"
11
+ assert_equal "user_credentials", UserSession.session_key
12
+ end
13
+ end
14
+
15
+ class InstanceMethodsTest < ActiveSupport::TestCase
16
+ def test_persist_persist_by_session
17
+ ben = users(:ben)
18
+ set_session_for(ben)
19
+ assert session = UserSession.find
20
+ assert_equal ben, session.record
21
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
22
+ end
23
+
24
+ def test_persist_persist_by_session_with_token_only
25
+ ben = users(:ben)
26
+ set_session_for(ben)
27
+ @controller.session["user_credentials_id"] = nil
28
+ assert session = UserSession.find
29
+ assert_equal ben, session.record
30
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
31
+ end
32
+
33
+ def test_after_save_update_session
34
+ ben = users(:ben)
35
+ session = UserSession.new(ben)
36
+ assert @controller.session["user_credentials"].blank?
37
+ assert session.save
38
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
39
+ end
40
+
41
+ def test_after_destroy_update_session
42
+ ben = users(:ben)
43
+ set_session_for(ben)
44
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
45
+ assert session = UserSession.find
46
+ assert session.destroy
47
+ assert @controller.session["user_credentials"].blank?
48
+ end
49
+
50
+ def test_after_persisting_update_session
51
+ ben = users(:ben)
52
+ set_cookie_for(ben)
53
+ assert @controller.session["user_credentials"].blank?
54
+ assert UserSession.find
55
+ assert_equal ben.persistence_token, @controller.session["user_credentials"]
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ module TimeoutTest
5
+ class ConfigTest < ActiveSupport::TestCase
6
+ def test_logout_on_timeout
7
+ UserSession.logout_on_timeout = true
8
+ assert UserSession.logout_on_timeout
9
+
10
+ UserSession.logout_on_timeout false
11
+ assert !UserSession.logout_on_timeout
12
+ end
13
+ end
14
+
15
+ class InstanceMethods < ActiveSupport::TestCase
16
+ def test_stale_state
17
+ UserSession.logout_on_timeout = true
18
+ ben = users(:ben)
19
+ ben.last_request_at = 3.years.ago
20
+ ben.save
21
+ set_session_for(ben)
22
+
23
+ session = UserSession.new
24
+ assert session.persisting?
25
+ assert session.stale?
26
+ assert_equal ben, session.stale_record
27
+ assert_nil session.record
28
+ assert_nil @controller.session["user_credentials_id"]
29
+
30
+ set_session_for(ben)
31
+
32
+ ben.last_request_at = Time.now
33
+ ben.save
34
+
35
+ assert session.persisting?
36
+ assert !session.stale?
37
+ assert_nil session.stale_record
38
+
39
+ UserSession.logout_on_timeout = false
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ class UnauthorizedRecordTest < ActiveSupport::TestCase
5
+ def test_credentials
6
+ ben = users(:ben)
7
+ session = UserSession.new
8
+ session.credentials = [ben]
9
+ assert_equal ben, session.unauthorized_record
10
+ assert_equal({:unauthorized_record => "<protected>"}, session.credentials)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + '/../test_helper.rb'
2
+
3
+ module SessionTest
4
+ class ValidationTest < ActiveSupport::TestCase
5
+ def test_errors
6
+ session = UserSession.new
7
+ assert session.errors.is_a?(Authlogic::Session::Validation::Errors)
8
+ end
9
+
10
+ def test_valid
11
+ session = UserSession.new
12
+ assert !session.valid?
13
+ assert_nil session.record
14
+ assert session.errors.count > 0
15
+
16
+ ben = users(:ben)
17
+ session.unauthorized_record = ben
18
+ assert session.valid?
19
+ assert_equal ben, session.attempted_record
20
+ assert session.errors.empty?
21
+ end
22
+ end
23
+ end
data/test/test_helper.rb CHANGED
@@ -3,11 +3,6 @@ require "rubygems"
3
3
  require "ruby-debug"
4
4
  require "active_record"
5
5
  require 'active_record/fixtures'
6
- require File.dirname(__FILE__) + '/../lib/authlogic' unless defined?(Authlogic)
7
- require File.dirname(__FILE__) + '/libs/mock_request'
8
- require File.dirname(__FILE__) + '/libs/mock_cookie_jar'
9
- require File.dirname(__FILE__) + '/libs/mock_controller'
10
- require File.dirname(__FILE__) + '/libs/user'
11
6
 
12
7
  ActiveRecord::Schema.verbose = false
13
8
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
@@ -45,8 +40,8 @@ ActiveRecord::Schema.define(:version => 1) do
45
40
  t.string :email
46
41
  t.string :first_name
47
42
  t.string :last_name
48
- t.integer :login_count
49
- t.integer :failed_login_count
43
+ t.integer :login_count, :default => 0, :null => false
44
+ t.integer :failed_login_count, :default => 0, :null => false
50
45
  t.datetime :last_request_at
51
46
  t.datetime :current_login_at
52
47
  t.datetime :last_login_at
@@ -67,7 +62,7 @@ ActiveRecord::Schema.define(:version => 1) do
67
62
  t.string :persistence_token
68
63
  t.string :first_name
69
64
  t.string :last_name
70
- t.integer :login_count
65
+ t.integer :login_count, :default => 0, :null => false
71
66
  t.datetime :last_request_at
72
67
  t.datetime :current_login_at
73
68
  t.datetime :last_login_at
@@ -76,31 +71,21 @@ ActiveRecord::Schema.define(:version => 1) do
76
71
  end
77
72
  end
78
73
 
79
- class Project < ActiveRecord::Base
80
- has_and_belongs_to_many :users
81
- end
82
-
83
- class UserSession < Authlogic::Session::Base
84
- end
85
-
86
- class EmployeeSession < Authlogic::Session::Base
87
- end
74
+ require File.dirname(__FILE__) + '/../lib/authlogic' unless defined?(Authlogic)
75
+ require File.dirname(__FILE__) + '/libs/mock_request'
76
+ require File.dirname(__FILE__) + '/libs/mock_cookie_jar'
77
+ require File.dirname(__FILE__) + '/libs/mock_controller'
78
+ require File.dirname(__FILE__) + '/libs/project'
79
+ require File.dirname(__FILE__) + '/libs/employee'
80
+ require File.dirname(__FILE__) + '/libs/employee_session'
81
+ require File.dirname(__FILE__) + '/libs/user'
82
+ require File.dirname(__FILE__) + '/libs/user_session'
83
+ require File.dirname(__FILE__) + '/libs/company'
88
84
 
89
- class Company < ActiveRecord::Base
90
- authenticates_many :employee_sessions
91
- authenticates_many :user_sessions
92
- has_many :employees, :dependent => :destroy
93
- has_many :users, :dependent => :destroy
94
- end
95
85
 
96
86
  Authlogic::CryptoProviders::AES256.key = "myafdsfddddddddddddddddddddddddddddddddddddddddddddddd"
97
87
 
98
- class Employee < ActiveRecord::Base
99
- acts_as_authentic :crypto_provider => Authlogic::CryptoProviders::AES256
100
- belongs_to :company
101
- end
102
-
103
- class Test::Unit::TestCase
88
+ class ActiveSupport::TestCase
104
89
  self.fixture_path = File.dirname(__FILE__) + "/fixtures"
105
90
  self.use_transactional_fixtures = true
106
91
  self.use_instantiated_fixtures = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 2.0.0
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-02-22 00:00:00 -05:00
12
+ date: 2009-03-23 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -23,14 +23,14 @@ dependencies:
23
23
  version: "0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: echoe
27
- type: :runtime
26
+ name: hoe
27
+ type: :development
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: "0"
33
+ version: 1.11.0
34
34
  version:
35
35
  description: A clean, simple, and unobtrusive ruby authentication solution.
36
36
  email: bjohnson@binarylogic.com
@@ -39,128 +39,125 @@ executables: []
39
39
  extensions: []
40
40
 
41
41
  extra_rdoc_files:
42
+ - Manifest.txt
42
43
  - CHANGELOG.rdoc
43
- - lib/authlogic/controller_adapters/abstract_adapter.rb
44
- - lib/authlogic/controller_adapters/merb_adapter.rb
45
- - lib/authlogic/controller_adapters/rails_adapter.rb
46
- - lib/authlogic/crypto_providers/aes256.rb
47
- - lib/authlogic/crypto_providers/bcrypt.rb
48
- - lib/authlogic/crypto_providers/sha1.rb
49
- - lib/authlogic/crypto_providers/sha512.rb
50
- - lib/authlogic/i18n.rb
51
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/base.rb
52
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/config.rb
53
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/credentials.rb
54
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/logged_in.rb
55
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/perishability.rb
56
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/persistence.rb
57
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/session_maintenance.rb
58
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/single_access.rb
59
- - lib/authlogic/orm_adapters/active_record_adapter/authenticates_many.rb
60
- - lib/authlogic/session/active_record_trickery.rb
61
- - lib/authlogic/session/authenticates_many_association.rb
62
- - lib/authlogic/session/base.rb
63
- - lib/authlogic/session/brute_force_protection.rb
64
- - lib/authlogic/session/callbacks.rb
65
- - lib/authlogic/session/config.rb
66
- - lib/authlogic/session/cookies.rb
67
- - lib/authlogic/session/errors.rb
68
- - lib/authlogic/session/params.rb
69
- - lib/authlogic/session/perishability.rb
70
- - lib/authlogic/session/record_info.rb
71
- - lib/authlogic/session/scopes.rb
72
- - lib/authlogic/session/session.rb
73
- - lib/authlogic/session/timeout.rb
74
- - lib/authlogic/testing/test_unit_helpers.rb
75
- - lib/authlogic/version.rb
76
- - lib/authlogic.rb
77
44
  - README.rdoc
78
45
  files:
79
46
  - CHANGELOG.rdoc
47
+ - MIT-LICENSE
48
+ - Manifest.txt
49
+ - README.rdoc
50
+ - Rakefile
80
51
  - generators/session/session_generator.rb
81
52
  - generators/session/templates/session.rb
82
53
  - init.rb
54
+ - lib/authlogic.rb
55
+ - lib/authlogic/acts_as_authentic/base.rb
56
+ - lib/authlogic/acts_as_authentic/email.rb
57
+ - lib/authlogic/acts_as_authentic/logged_in_status.rb
58
+ - lib/authlogic/acts_as_authentic/login.rb
59
+ - lib/authlogic/acts_as_authentic/magic_columns.rb
60
+ - lib/authlogic/acts_as_authentic/password.rb
61
+ - lib/authlogic/acts_as_authentic/perishable_token.rb
62
+ - lib/authlogic/acts_as_authentic/persistence_token.rb
63
+ - lib/authlogic/acts_as_authentic/restful_authentication.rb
64
+ - lib/authlogic/acts_as_authentic/session_maintenance.rb
65
+ - lib/authlogic/acts_as_authentic/single_access_token.rb
66
+ - lib/authlogic/acts_as_authentic/validations_scope.rb
67
+ - lib/authlogic/authenticates_many/association.rb
68
+ - lib/authlogic/authenticates_many/base.rb
83
69
  - lib/authlogic/controller_adapters/abstract_adapter.rb
84
70
  - lib/authlogic/controller_adapters/merb_adapter.rb
85
71
  - lib/authlogic/controller_adapters/rails_adapter.rb
86
72
  - lib/authlogic/crypto_providers/aes256.rb
87
73
  - lib/authlogic/crypto_providers/bcrypt.rb
74
+ - lib/authlogic/crypto_providers/md5.rb
88
75
  - lib/authlogic/crypto_providers/sha1.rb
89
76
  - lib/authlogic/crypto_providers/sha512.rb
90
77
  - lib/authlogic/i18n.rb
91
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/base.rb
92
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/config.rb
93
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/credentials.rb
94
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/logged_in.rb
95
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/perishability.rb
96
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/persistence.rb
97
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/session_maintenance.rb
98
- - lib/authlogic/orm_adapters/active_record_adapter/acts_as_authentic/single_access.rb
99
- - lib/authlogic/orm_adapters/active_record_adapter/authenticates_many.rb
78
+ - lib/authlogic/random.rb
79
+ - lib/authlogic/session/activation.rb
100
80
  - lib/authlogic/session/active_record_trickery.rb
101
- - lib/authlogic/session/authenticates_many_association.rb
102
81
  - lib/authlogic/session/base.rb
103
82
  - lib/authlogic/session/brute_force_protection.rb
104
83
  - lib/authlogic/session/callbacks.rb
105
- - lib/authlogic/session/config.rb
106
84
  - lib/authlogic/session/cookies.rb
107
- - lib/authlogic/session/errors.rb
85
+ - lib/authlogic/session/existence.rb
86
+ - lib/authlogic/session/foundation.rb
87
+ - lib/authlogic/session/http_auth.rb
88
+ - lib/authlogic/session/id.rb
89
+ - lib/authlogic/session/klass.rb
90
+ - lib/authlogic/session/magic_columns.rb
91
+ - lib/authlogic/session/magic_states.rb
108
92
  - lib/authlogic/session/params.rb
109
- - lib/authlogic/session/perishability.rb
110
- - lib/authlogic/session/record_info.rb
93
+ - lib/authlogic/session/password.rb
94
+ - lib/authlogic/session/perishable_token.rb
95
+ - lib/authlogic/session/persistence.rb
96
+ - lib/authlogic/session/priority_record.rb
111
97
  - lib/authlogic/session/scopes.rb
112
98
  - lib/authlogic/session/session.rb
113
99
  - lib/authlogic/session/timeout.rb
100
+ - lib/authlogic/session/unauthorized_record.rb
101
+ - lib/authlogic/session/validation.rb
114
102
  - lib/authlogic/testing/test_unit_helpers.rb
115
103
  - lib/authlogic/version.rb
116
- - lib/authlogic.rb
117
- - Manifest
118
- - MIT-LICENSE
119
- - Rakefile
120
- - README.rdoc
121
104
  - shoulda_macros/authlogic.rb
122
- - test/crypto_provider_tests/aes256_test.rb
123
- - test/crypto_provider_tests/bcrypt_test.rb
124
- - test/crypto_provider_tests/sha1_test.rb
125
- - test/crypto_provider_tests/sha512_test.rb
105
+ - test/acts_as_authentic_test/base_test.rb
106
+ - test/acts_as_authentic_test/email_test.rb
107
+ - test/acts_as_authentic_test/logged_in_status_test.rb
108
+ - test/acts_as_authentic_test/login_test.rb
109
+ - test/acts_as_authentic_test/magic_columns_test.rb
110
+ - test/acts_as_authentic_test/password_test.rb
111
+ - test/acts_as_authentic_test/perishable_token_test.rb
112
+ - test/acts_as_authentic_test/persistence_token_test.rb
113
+ - test/acts_as_authentic_test/session_maintenance_test.rb
114
+ - test/acts_as_authentic_test/single_access_test.rb
115
+ - test/authenticates_many_test.rb
116
+ - test/crypto_provider_test/aes256_test.rb
117
+ - test/crypto_provider_test/bcrypt_test.rb
118
+ - test/crypto_provider_test/sha1_test.rb
119
+ - test/crypto_provider_test/sha512_test.rb
126
120
  - test/fixtures/companies.yml
127
121
  - test/fixtures/employees.yml
128
122
  - test/fixtures/projects.yml
129
123
  - test/fixtures/users.yml
124
+ - test/libs/company.rb
125
+ - test/libs/employee.rb
126
+ - test/libs/employee_session.rb
130
127
  - test/libs/mock_controller.rb
131
128
  - test/libs/mock_cookie_jar.rb
132
129
  - test/libs/mock_request.rb
133
130
  - test/libs/ordered_hash.rb
131
+ - test/libs/project.rb
134
132
  - test/libs/user.rb
135
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/config_test.rb
136
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/credentials_test.rb
137
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/logged_in_test.rb
138
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/perishability_test.rb
139
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/persistence_test.rb
140
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/session_maintenance_test.rb
141
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
142
- - test/orm_adapters_tests/active_record_adapter_tests/authenticates_many_test.rb
143
- - test/session_tests/active_record_trickery_test.rb
144
- - test/session_tests/authenticates_many_association_test.rb
145
- - test/session_tests/base_test.rb
146
- - test/session_tests/brute_force_protection_test.rb
147
- - test/session_tests/config_test.rb
148
- - test/session_tests/cookies_test.rb
149
- - test/session_tests/params_test.rb
150
- - test/session_tests/perishability_test.rb
151
- - test/session_tests/scopes_test.rb
152
- - test/session_tests/session_test.rb
153
- - test/session_tests/timeout_test.rb
133
+ - test/libs/user_session.rb
134
+ - test/random_test.rb
135
+ - test/session_test/activation_test.rb
136
+ - test/session_test/active_record_trickery_test.rb
137
+ - test/session_test/brute_force_protection_test.rb
138
+ - test/session_test/callbacks_test.rb
139
+ - test/session_test/cookies_test.rb
140
+ - test/session_test/credentials_test.rb
141
+ - test/session_test/existence_test.rb
142
+ - test/session_test/http_auth_test.rb
143
+ - test/session_test/id_test.rb
144
+ - test/session_test/klass_test.rb
145
+ - test/session_test/magic_columns_test.rb
146
+ - test/session_test/magic_states_test.rb
147
+ - test/session_test/params_test.rb
148
+ - test/session_test/password_test.rb
149
+ - test/session_test/perishability_test.rb
150
+ - test/session_test/persistence_test.rb
151
+ - test/session_test/scopes_test.rb
152
+ - test/session_test/session_test.rb
153
+ - test/session_test/timeout_test.rb
154
+ - test/session_test/unauthorized_record_test.rb
155
+ - test/session_test/validation_test.rb
154
156
  - test/test_helper.rb
155
- - authlogic.gemspec
156
157
  has_rdoc: true
157
158
  homepage: http://github.com/binarylogic/authlogic
158
- post_install_message:
159
+ post_install_message: "Version 2.0 introduces some changes that break backwards compatibility. The big change is how acts_as_authentic accepts configuration options. Instead of a hash, it now accepts a block: acts_as_authentic { |c| c.my_config_option = my_value}. See the docs for more details."
159
160
  rdoc_options:
160
- - --line-numbers
161
- - --inline-source
162
- - --title
163
- - Authlogic
164
161
  - --main
165
162
  - README.rdoc
166
163
  require_paths:
@@ -175,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
172
  requirements:
176
173
  - - ">="
177
174
  - !ruby/object:Gem::Version
178
- version: "1.2"
175
+ version: "0"
179
176
  version:
180
177
  requirements: []
181
178
 
@@ -185,27 +182,38 @@ signing_key:
185
182
  specification_version: 2
186
183
  summary: A clean, simple, and unobtrusive ruby authentication solution.
187
184
  test_files:
188
- - test/crypto_provider_tests/aes256_test.rb
189
- - test/crypto_provider_tests/bcrypt_test.rb
190
- - test/crypto_provider_tests/sha1_test.rb
191
- - test/crypto_provider_tests/sha512_test.rb
192
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/config_test.rb
193
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/credentials_test.rb
194
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/logged_in_test.rb
195
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/perishability_test.rb
196
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/persistence_test.rb
197
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/session_maintenance_test.rb
198
- - test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
199
- - test/orm_adapters_tests/active_record_adapter_tests/authenticates_many_test.rb
200
- - test/session_tests/active_record_trickery_test.rb
201
- - test/session_tests/authenticates_many_association_test.rb
202
- - test/session_tests/base_test.rb
203
- - test/session_tests/brute_force_protection_test.rb
204
- - test/session_tests/config_test.rb
205
- - test/session_tests/cookies_test.rb
206
- - test/session_tests/params_test.rb
207
- - test/session_tests/perishability_test.rb
208
- - test/session_tests/scopes_test.rb
209
- - test/session_tests/session_test.rb
210
- - test/session_tests/timeout_test.rb
211
- - test/test_helper.rb
185
+ - test/acts_as_authentic_test/base_test.rb
186
+ - test/acts_as_authentic_test/email_test.rb
187
+ - test/acts_as_authentic_test/logged_in_status_test.rb
188
+ - test/acts_as_authentic_test/login_test.rb
189
+ - test/acts_as_authentic_test/magic_columns_test.rb
190
+ - test/acts_as_authentic_test/password_test.rb
191
+ - test/acts_as_authentic_test/perishable_token_test.rb
192
+ - test/acts_as_authentic_test/persistence_token_test.rb
193
+ - test/acts_as_authentic_test/session_maintenance_test.rb
194
+ - test/acts_as_authentic_test/single_access_test.rb
195
+ - test/crypto_provider_test/aes256_test.rb
196
+ - test/crypto_provider_test/bcrypt_test.rb
197
+ - test/crypto_provider_test/sha1_test.rb
198
+ - test/crypto_provider_test/sha512_test.rb
199
+ - test/session_test/activation_test.rb
200
+ - test/session_test/active_record_trickery_test.rb
201
+ - test/session_test/brute_force_protection_test.rb
202
+ - test/session_test/callbacks_test.rb
203
+ - test/session_test/cookies_test.rb
204
+ - test/session_test/credentials_test.rb
205
+ - test/session_test/existence_test.rb
206
+ - test/session_test/http_auth_test.rb
207
+ - test/session_test/id_test.rb
208
+ - test/session_test/klass_test.rb
209
+ - test/session_test/magic_columns_test.rb
210
+ - test/session_test/magic_states_test.rb
211
+ - test/session_test/params_test.rb
212
+ - test/session_test/password_test.rb
213
+ - test/session_test/perishability_test.rb
214
+ - test/session_test/persistence_test.rb
215
+ - test/session_test/scopes_test.rb
216
+ - test/session_test/session_test.rb
217
+ - test/session_test/timeout_test.rb
218
+ - test/session_test/unauthorized_record_test.rb
219
+ - test/session_test/validation_test.rb