authlogic_rpx 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/CHANGELOG.rdoc +45 -38
  2. data/MIT-LICENSE +20 -20
  3. data/Manifest +37 -37
  4. data/README.rdoc +751 -747
  5. data/Rakefile +54 -47
  6. data/authlogic_rpx.gemspec +101 -38
  7. data/generators/add_authlogic_rpx_migration/USAGE +18 -18
  8. data/generators/add_authlogic_rpx_migration/add_authlogic_rpx_migration_generator.rb +44 -44
  9. data/generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb +34 -34
  10. data/generators/add_authlogic_rpx_migration/templates/migration_no_mapping.rb +29 -29
  11. data/lib/authlogic_rpx.rb +8 -8
  12. data/lib/authlogic_rpx/acts_as_authentic.rb +297 -281
  13. data/lib/authlogic_rpx/helper.rb +53 -43
  14. data/lib/authlogic_rpx/rpx_identifier.rb +4 -5
  15. data/lib/authlogic_rpx/session.rb +224 -218
  16. data/lib/authlogic_rpx/version.rb +50 -50
  17. data/test/fixtures/rpxresponses.yml +20 -20
  18. data/test/fixtures/users.yml +19 -19
  19. data/test/integration/basic_authentication_and_registration_test.rb +52 -52
  20. data/test/integration/internal_mapping/basic_authentication_and_registration_test.rb +3 -3
  21. data/test/integration/internal_mapping/settings_test.rb +9 -9
  22. data/test/integration/no_mapping/basic_authentication_and_registration_test.rb +3 -3
  23. data/test/integration/no_mapping/settings_test.rb +9 -9
  24. data/test/libs/ext_test_unit.rb +30 -30
  25. data/test/libs/mock_rpx_now.rb +33 -33
  26. data/test/libs/rails_trickery.rb +40 -40
  27. data/test/libs/rpxresponse.rb +2 -2
  28. data/test/libs/user.rb +2 -2
  29. data/test/libs/user_session.rb +2 -2
  30. data/test/test_helper.rb +84 -86
  31. data/test/test_internal_mapping_helper.rb +93 -95
  32. data/test/unit/acts_as_authentic_settings_test.rb +41 -41
  33. data/test/unit/session_settings_test.rb +37 -37
  34. data/test/unit/session_validation_test.rb +15 -15
  35. data/test/unit/verify_rpx_mock_test.rb +28 -28
  36. metadata +66 -32
data/Rakefile CHANGED
@@ -1,48 +1,55 @@
1
- ENV['RDOCOPT'] = "-S -f html -T hanna"
2
-
3
- require "rubygems"
4
- require "echoe"
5
- require File.dirname(__FILE__) << "/lib/authlogic_rpx/version"
6
-
7
- Echoe.new("authlogic_rpx") do |p|
8
- p.version = AuthlogicRpx::Version::STRING
9
- p.url = "http://github.com/tardate/authlogic_rpx"
10
- p.summary = "Authlogic plug-in for RPX support"
11
- p.description = "Authlogic extension/plugin that provides RPX (rpxnow.com) authentication support"
12
-
13
- p.runtime_dependencies = ["authlogic >=2.1.3", "rpx_now >=0.6.12" ]
14
- p.development_dependencies = []
15
-
16
- p.author = "Paul Gallagher / tardate"
17
- p.email = "gallagher.paul@gmail.com"
18
-
19
- p.install_message = ""
20
- end
21
-
22
-
23
- Rake::Task[:test].clear
24
-
25
- Rake::TestTask.new(:unit) do |t|
26
- t.libs << "test/libs"
27
- t.pattern = 'test/unit/*test.rb'
28
- t.verbose = true
29
- end
30
-
31
- Rake::TestTask.new(:no_mapping) do |t|
32
- t.libs << "test/libs"
33
- t.test_files = FileList.new('test/unit/*test.rb', 'test/integration/no_mapping/*test.rb')
34
- t.verbose = true
35
- end
36
-
37
- Rake::TestTask.new(:internal_mapping) do |t|
38
- t.libs << "test/libs"
39
- t.test_files = FileList.new('test/integration/internal_mapping/*test.rb')
40
- t.verbose = true
41
- end
42
-
43
- task :test do
44
- Rake::Task[:no_mapping].invoke
45
- Rake::Task[:internal_mapping].invoke
46
- end
47
-
1
+ ENV['RDOCOPT'] = "-S -f html -T hanna"
2
+
3
+ require "rubygems"
4
+ require 'rake'
5
+
6
+ require File.dirname(__FILE__) << "/lib/authlogic_rpx/version"
7
+
8
+ begin
9
+ require 'jeweler'
10
+ Jeweler::Tasks.new do |gem|
11
+ gem.name = "authlogic_rpx"
12
+ gem.version = AuthlogicRpx::Version::STRING
13
+ gem.summary = %Q{Authlogic plug-in for RPX support}
14
+ gem.description = %Q{Authlogic extension/plugin that provides RPX (rpxnow.com) authentication support}
15
+ gem.email = "gallagher.paul@gmail.com"
16
+ gem.homepage = "http://github.com/tardate/authlogic_rpx"
17
+ gem.authors = [ "Paul Gallagher / tardate <gallagher.paul@gmail.com>" ]
18
+ gem.add_dependency "authlogic", "= 2.1.6"
19
+ gem.add_dependency "rpx_now", "= 0.6.23"
20
+ gem.add_development_dependency "test-unit", ">= 2.1.1"
21
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
+ end
23
+ Jeweler::GemcutterTasks.new
24
+ rescue LoadError
25
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
26
+ end
27
+
28
+ require 'rake/testtask'
29
+
30
+ namespace :test do
31
+ Rake::TestTask.new(:units) do |t|
32
+ t.libs << "test/libs"
33
+ t.pattern = 'test/unit/*test.rb'
34
+ t.verbose = true
35
+ end
36
+
37
+ Rake::TestTask.new(:no_mapping) do |t|
38
+ t.libs << "test/libs"
39
+ t.test_files = FileList.new('test/unit/*test.rb', 'test/integration/no_mapping/*test.rb')
40
+ t.verbose = true
41
+ end
42
+
43
+ Rake::TestTask.new(:internal_mapping) do |t|
44
+ t.libs << "test/libs"
45
+ t.test_files = FileList.new('test/integration/internal_mapping/*test.rb')
46
+ t.verbose = true
47
+ end
48
+ end
49
+
50
+ task :test do
51
+ Rake::Task['test:no_mapping'].invoke
52
+ Rake::Task['test:internal_mapping'].invoke
53
+ end
54
+
48
55
  task :default => :test
@@ -1,38 +1,101 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{authlogic_rpx}
5
- s.version = "1.1.1"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Paul Gallagher / tardate"]
9
- s.date = %q{2010-01-17}
10
- s.description = %q{Authlogic extension/plugin that provides RPX (rpxnow.com) authentication support}
11
- s.email = %q{gallagher.paul@gmail.com}
12
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc", "lib/authlogic_rpx.rb", "lib/authlogic_rpx/acts_as_authentic.rb", "lib/authlogic_rpx/helper.rb", "lib/authlogic_rpx/rpx_identifier.rb", "lib/authlogic_rpx/session.rb", "lib/authlogic_rpx/version.rb"]
13
- s.files = ["CHANGELOG.rdoc", "MIT-LICENSE", "Manifest", "README.rdoc", "Rakefile", "authlogic_rpx.gemspec", "generators/add_authlogic_rpx_migration/USAGE", "generators/add_authlogic_rpx_migration/add_authlogic_rpx_migration_generator.rb", "generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb", "generators/add_authlogic_rpx_migration/templates/migration_no_mapping.rb", "init.rb", "lib/authlogic_rpx.rb", "lib/authlogic_rpx/acts_as_authentic.rb", "lib/authlogic_rpx/helper.rb", "lib/authlogic_rpx/rpx_identifier.rb", "lib/authlogic_rpx/session.rb", "lib/authlogic_rpx/version.rb", "rails/init.rb", "test/fixtures/rpxresponses.yml", "test/fixtures/users.yml", "test/integration/basic_authentication_and_registration_test.rb", "test/integration/internal_mapping/basic_authentication_and_registration_test.rb", "test/integration/internal_mapping/settings_test.rb", "test/integration/no_mapping/basic_authentication_and_registration_test.rb", "test/integration/no_mapping/settings_test.rb", "test/libs/ext_test_unit.rb", "test/libs/mock_rpx_now.rb", "test/libs/rails_trickery.rb", "test/libs/rpxresponse.rb", "test/libs/user.rb", "test/libs/user_session.rb", "test/test_helper.rb", "test/test_internal_mapping_helper.rb", "test/unit/acts_as_authentic_settings_test.rb", "test/unit/session_settings_test.rb", "test/unit/session_validation_test.rb", "test/unit/verify_rpx_mock_test.rb"]
14
- s.homepage = %q{http://github.com/tardate/authlogic_rpx}
15
- s.post_install_message = %q{}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Authlogic_rpx", "--main", "README.rdoc"]
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{authlogic_rpx}
19
- s.rubygems_version = %q{1.3.5}
20
- s.summary = %q{Authlogic plug-in for RPX support}
21
- s.test_files = ["test/integration/basic_authentication_and_registration_test.rb", "test/integration/internal_mapping/basic_authentication_and_registration_test.rb", "test/integration/internal_mapping/settings_test.rb", "test/integration/no_mapping/basic_authentication_and_registration_test.rb", "test/integration/no_mapping/settings_test.rb", "test/test_helper.rb", "test/test_internal_mapping_helper.rb", "test/unit/acts_as_authentic_settings_test.rb", "test/unit/session_settings_test.rb", "test/unit/session_validation_test.rb", "test/unit/verify_rpx_mock_test.rb"]
22
-
23
- if s.respond_to? :specification_version then
24
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
- s.specification_version = 3
26
-
27
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
- s.add_runtime_dependency(%q<authlogic>, [">= 2.1.3"])
29
- s.add_runtime_dependency(%q<rpx_now>, [">= 0.6.12"])
30
- else
31
- s.add_dependency(%q<authlogic>, [">= 2.1.3"])
32
- s.add_dependency(%q<rpx_now>, [">= 0.6.12"])
33
- end
34
- else
35
- s.add_dependency(%q<authlogic>, [">= 2.1.3"])
36
- s.add_dependency(%q<rpx_now>, [">= 0.6.12"])
37
- end
38
- end
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{authlogic_rpx}
8
+ s.version = "1.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Paul Gallagher / tardate <gallagher.paul@gmail.com>"]
12
+ s.date = %q{2010-09-28}
13
+ s.description = %q{Authlogic extension/plugin that provides RPX (rpxnow.com) authentication support}
14
+ s.email = %q{gallagher.paul@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "CHANGELOG.rdoc",
20
+ "MIT-LICENSE",
21
+ "Manifest",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "authlogic_rpx.gemspec",
25
+ "generators/add_authlogic_rpx_migration/USAGE",
26
+ "generators/add_authlogic_rpx_migration/add_authlogic_rpx_migration_generator.rb",
27
+ "generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb",
28
+ "generators/add_authlogic_rpx_migration/templates/migration_no_mapping.rb",
29
+ "init.rb",
30
+ "lib/authlogic_rpx.rb",
31
+ "lib/authlogic_rpx/acts_as_authentic.rb",
32
+ "lib/authlogic_rpx/helper.rb",
33
+ "lib/authlogic_rpx/rpx_identifier.rb",
34
+ "lib/authlogic_rpx/session.rb",
35
+ "lib/authlogic_rpx/version.rb",
36
+ "rails/init.rb",
37
+ "test/fixtures/rpxresponses.yml",
38
+ "test/fixtures/users.yml",
39
+ "test/integration/basic_authentication_and_registration_test.rb",
40
+ "test/integration/internal_mapping/basic_authentication_and_registration_test.rb",
41
+ "test/integration/internal_mapping/settings_test.rb",
42
+ "test/integration/no_mapping/basic_authentication_and_registration_test.rb",
43
+ "test/integration/no_mapping/settings_test.rb",
44
+ "test/libs/ext_test_unit.rb",
45
+ "test/libs/mock_rpx_now.rb",
46
+ "test/libs/rails_trickery.rb",
47
+ "test/libs/rpxresponse.rb",
48
+ "test/libs/user.rb",
49
+ "test/libs/user_session.rb",
50
+ "test/test_helper.rb",
51
+ "test/test_internal_mapping_helper.rb",
52
+ "test/unit/acts_as_authentic_settings_test.rb",
53
+ "test/unit/session_settings_test.rb",
54
+ "test/unit/session_validation_test.rb",
55
+ "test/unit/verify_rpx_mock_test.rb"
56
+ ]
57
+ s.homepage = %q{http://github.com/tardate/authlogic_rpx}
58
+ s.rdoc_options = ["--charset=UTF-8"]
59
+ s.require_paths = ["lib"]
60
+ s.rubygems_version = %q{1.3.7}
61
+ s.summary = %q{Authlogic plug-in for RPX support}
62
+ s.test_files = [
63
+ "test/integration/basic_authentication_and_registration_test.rb",
64
+ "test/integration/internal_mapping/basic_authentication_and_registration_test.rb",
65
+ "test/integration/internal_mapping/settings_test.rb",
66
+ "test/integration/no_mapping/basic_authentication_and_registration_test.rb",
67
+ "test/integration/no_mapping/settings_test.rb",
68
+ "test/libs/ext_test_unit.rb",
69
+ "test/libs/mock_rpx_now.rb",
70
+ "test/libs/rails_trickery.rb",
71
+ "test/libs/rpxresponse.rb",
72
+ "test/libs/user.rb",
73
+ "test/libs/user_session.rb",
74
+ "test/test_helper.rb",
75
+ "test/test_internal_mapping_helper.rb",
76
+ "test/unit/acts_as_authentic_settings_test.rb",
77
+ "test/unit/session_settings_test.rb",
78
+ "test/unit/session_validation_test.rb",
79
+ "test/unit/verify_rpx_mock_test.rb"
80
+ ]
81
+
82
+ if s.respond_to? :specification_version then
83
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
84
+ s.specification_version = 3
85
+
86
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
87
+ s.add_runtime_dependency(%q<authlogic>, ["= 2.1.6"])
88
+ s.add_runtime_dependency(%q<rpx_now>, ["= 0.6.23"])
89
+ s.add_development_dependency(%q<test-unit>, [">= 2.1.1"])
90
+ else
91
+ s.add_dependency(%q<authlogic>, ["= 2.1.6"])
92
+ s.add_dependency(%q<rpx_now>, ["= 0.6.23"])
93
+ s.add_dependency(%q<test-unit>, [">= 2.1.1"])
94
+ end
95
+ else
96
+ s.add_dependency(%q<authlogic>, ["= 2.1.6"])
97
+ s.add_dependency(%q<rpx_now>, ["= 0.6.23"])
98
+ s.add_dependency(%q<test-unit>, [">= 2.1.1"])
99
+ end
100
+ end
101
+
@@ -1,18 +1,18 @@
1
- Description:
2
- ruby script/generate add_authlogic_rpx_migration [mapping:mapping_mode] [user_model:model_name]
3
-
4
- Creates an add_authlogic_rpx_migration file in db/migrate.
5
-
6
- The mapping_mode parameter indicates which style of Authlogic_RPX-supported identity
7
- mapping should be used. Allowed values for mapping_mode are:
8
- none
9
- internal
10
- Default mapping_mode is 'internal'
11
-
12
- The user_model parameter specifies the name of the user/member model in your application.
13
- Default model_name is 'User'
14
-
15
- e.g. to generate the RPX migration where the user model is called 'Member' and you do not
16
- want to support identity mapping:
17
-
18
- ruby script/generate add_authlogic_rpx_migration mapping:none user_model:member
1
+ Description:
2
+ ruby script/generate add_authlogic_rpx_migration [mapping:mapping_mode] [user_model:model_name]
3
+
4
+ Creates an add_authlogic_rpx_migration file in db/migrate.
5
+
6
+ The mapping_mode parameter indicates which style of Authlogic_RPX-supported identity
7
+ mapping should be used. Allowed values for mapping_mode are:
8
+ none
9
+ internal
10
+ Default mapping_mode is 'internal'
11
+
12
+ The user_model parameter specifies the name of the user/member model in your application.
13
+ Default model_name is 'User'
14
+
15
+ e.g. to generate the RPX migration where the user model is called 'Member' and you do not
16
+ want to support identity mapping:
17
+
18
+ ruby script/generate add_authlogic_rpx_migration mapping:none user_model:member
@@ -1,44 +1,44 @@
1
- class AddAuthlogicRpxMigrationGenerator < Rails::Generator::Base
2
- def manifest
3
-
4
- record do |m|
5
-
6
- m.migration_template template_name, 'db/migrate', :assigns => {
7
- :user_model_base => user_model_base,
8
- :user_model => user_model,
9
- :user_model_collection => user_model_collection
10
- }
11
- end
12
- end
13
-
14
- def file_name
15
- "add_authlogic_rpx_migration"
16
- end
17
-
18
- protected
19
- # Override with your own usage banner.
20
- def banner
21
- "Usage: #{$0} #{spec.name} [options] [mapping:mapping_mode] [user_model:model_name]"
22
- end
23
-
24
- attr_writer :params
25
- def params
26
- @params ||= {"mapping" => "internal", "user_model" => "User"}.merge( Hash[*(@args.collect { |arg| arg.split(":") }.flatten)] )
27
- end
28
-
29
- def user_model_base
30
- params['user_model'].singularize.downcase
31
- end
32
- def user_model
33
- params['user_model'].singularize.capitalize
34
- end
35
- def user_model_collection
36
- params['user_model'].pluralize.downcase
37
- end
38
- def mapping
39
- params['mapping']
40
- end
41
- def template_name
42
- mapping == 'none' ? 'migration_no_mapping.rb' : 'migration_internal_mapping.rb'
43
- end
44
- end
1
+ class AddAuthlogicRpxMigrationGenerator < Rails::Generator::Base
2
+ def manifest
3
+
4
+ record do |m|
5
+
6
+ m.migration_template template_name, 'db/migrate', :assigns => {
7
+ :user_model_base => user_model_base,
8
+ :user_model => user_model,
9
+ :user_model_collection => user_model_collection
10
+ }
11
+ end
12
+ end
13
+
14
+ def file_name
15
+ "add_authlogic_rpx_migration"
16
+ end
17
+
18
+ protected
19
+ # Override with your own usage banner.
20
+ def banner
21
+ "Usage: #{$0} #{spec.name} [options] [mapping:mapping_mode] [user_model:model_name]"
22
+ end
23
+
24
+ attr_writer :params
25
+ def params
26
+ @params ||= {"mapping" => "internal", "user_model" => "User"}.merge( Hash[*(@args.collect { |arg| arg.split(":") }.flatten)] )
27
+ end
28
+
29
+ def user_model_base
30
+ params['user_model'].singularize.downcase
31
+ end
32
+ def user_model
33
+ params['user_model'].singularize.capitalize
34
+ end
35
+ def user_model_collection
36
+ params['user_model'].pluralize.downcase
37
+ end
38
+ def mapping
39
+ params['mapping']
40
+ end
41
+ def template_name
42
+ mapping == 'none' ? 'migration_no_mapping.rb' : 'migration_internal_mapping.rb'
43
+ end
44
+ end
@@ -1,34 +1,34 @@
1
- class AddAuthlogicRpxMigration < ActiveRecord::Migration
2
- def self.up
3
- create_table :rpx_identifiers do |t|
4
- t.string :identifier, :null => false
5
- t.string :provider_name
6
- t.integer :<%= user_model_base %>_id, :null => false
7
- t.timestamps
8
- end
9
- add_index :rpx_identifiers, :identifier, :unique => true, :null => false
10
- add_index :rpx_identifiers, :<%= user_model_base %>_id, :unique => false, :null => false
11
-
12
- # == Customisation may be required here ==
13
- # You may need to remove database constraints on other fields if they will be unused in the RPX case
14
- # (e.g. crypted_password and password_salt to make password authentication optional).
15
- # If you are using auto-registration, you must also remove any database constraints for fields that will be automatically mapped
16
- # e.g.:
17
- #change_column :<%= user_model_collection %>, :crypted_password, :string, :default => nil, :null => true
18
- #change_column :<%= user_model_collection %>, :password_salt, :string, :default => nil, :null => true
19
-
20
- end
21
-
22
- def self.down
23
- drop_table :rpx_identifiers
24
-
25
- # == Customisation may be required here ==
26
- # Restore user model database constraints as appropriate
27
- # e.g.:
28
- #[:crypted_password, :password_salt].each do |field|
29
- # <%= user_model %>.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
30
- # change_column :<%= user_model_collection %>, field, :string, :default => "", :null => false
31
- #end
32
-
33
- end
34
- end
1
+ class AddAuthlogicRpxMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :rpx_identifiers do |t|
4
+ t.string :identifier, :null => false
5
+ t.string :provider_name
6
+ t.integer :<%= user_model_base %>_id, :null => false
7
+ t.timestamps
8
+ end
9
+ add_index :rpx_identifiers, :identifier, :unique => true, :null => false
10
+ add_index :rpx_identifiers, :<%= user_model_base %>_id, :unique => false, :null => false
11
+
12
+ # == Customisation may be required here ==
13
+ # You may need to remove database constraints on other fields if they will be unused in the RPX case
14
+ # (e.g. crypted_password and password_salt to make password authentication optional).
15
+ # If you are using auto-registration, you must also remove any database constraints for fields that will be automatically mapped
16
+ # e.g.:
17
+ #change_column :<%= user_model_collection %>, :crypted_password, :string, :default => nil, :null => true
18
+ #change_column :<%= user_model_collection %>, :password_salt, :string, :default => nil, :null => true
19
+
20
+ end
21
+
22
+ def self.down
23
+ drop_table :rpx_identifiers
24
+
25
+ # == Customisation may be required here ==
26
+ # Restore user model database constraints as appropriate
27
+ # e.g.:
28
+ #[:crypted_password, :password_salt].each do |field|
29
+ # <%= user_model %>.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
30
+ # change_column :<%= user_model_collection %>, field, :string, :default => "", :null => false
31
+ #end
32
+
33
+ end
34
+ end
@@ -1,29 +1,29 @@
1
- class AddAuthlogicRpxMigration < ActiveRecord::Migration
2
-
3
- def self.up
4
- add_column :<%= user_model_collection %>, :rpx_identifier, :string
5
- add_index :<%= user_model_collection %>, :rpx_identifier
6
-
7
- # == Customisation may be required here ==
8
- # You may need to remove database constraints on other fields if they will be unused in the RPX case
9
- # (e.g. crypted_password and password_salt to make password authentication optional).
10
- # If you are using auto-registration, you must also remove any database constraints for fields that will be automatically mapped
11
- # e.g.:
12
- #change_column :<%= user_model_collection %>, :crypted_password, :string, :default => nil, :null => true
13
- #change_column :<%= user_model_collection %>, :password_salt, :string, :default => nil, :null => true
14
-
15
- end
16
-
17
- def self.down
18
- remove_column :<%= user_model_collection %>, :rpx_identifier
19
-
20
- # == Customisation may be required here ==
21
- # Restore user model database constraints as appropriate
22
- # e.g.:
23
- #[:crypted_password, :password_salt].each do |field|
24
- # <%= user_model %>.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
25
- # change_column :<%= user_model_collection %>, field, :string, :default => "", :null => false
26
- #end
27
-
28
- end
29
- end
1
+ class AddAuthlogicRpxMigration < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ add_column :<%= user_model_collection %>, :rpx_identifier, :string
5
+ add_index :<%= user_model_collection %>, :rpx_identifier
6
+
7
+ # == Customisation may be required here ==
8
+ # You may need to remove database constraints on other fields if they will be unused in the RPX case
9
+ # (e.g. crypted_password and password_salt to make password authentication optional).
10
+ # If you are using auto-registration, you must also remove any database constraints for fields that will be automatically mapped
11
+ # e.g.:
12
+ #change_column :<%= user_model_collection %>, :crypted_password, :string, :default => nil, :null => true
13
+ #change_column :<%= user_model_collection %>, :password_salt, :string, :default => nil, :null => true
14
+
15
+ end
16
+
17
+ def self.down
18
+ remove_column :<%= user_model_collection %>, :rpx_identifier
19
+
20
+ # == Customisation may be required here ==
21
+ # Restore user model database constraints as appropriate
22
+ # e.g.:
23
+ #[:crypted_password, :password_salt].each do |field|
24
+ # <%= user_model %>.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? }
25
+ # change_column :<%= user_model_collection %>, field, :string, :default => "", :null => false
26
+ #end
27
+
28
+ end
29
+ end