authlogic_rpx 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +45 -38
- data/MIT-LICENSE +20 -20
- data/Manifest +37 -37
- data/README.rdoc +751 -747
- data/Rakefile +54 -47
- data/authlogic_rpx.gemspec +101 -38
- data/generators/add_authlogic_rpx_migration/USAGE +18 -18
- data/generators/add_authlogic_rpx_migration/add_authlogic_rpx_migration_generator.rb +44 -44
- data/generators/add_authlogic_rpx_migration/templates/migration_internal_mapping.rb +34 -34
- data/generators/add_authlogic_rpx_migration/templates/migration_no_mapping.rb +29 -29
- data/lib/authlogic_rpx.rb +8 -8
- data/lib/authlogic_rpx/acts_as_authentic.rb +297 -281
- data/lib/authlogic_rpx/helper.rb +53 -43
- data/lib/authlogic_rpx/rpx_identifier.rb +4 -5
- data/lib/authlogic_rpx/session.rb +224 -218
- data/lib/authlogic_rpx/version.rb +50 -50
- data/test/fixtures/rpxresponses.yml +20 -20
- data/test/fixtures/users.yml +19 -19
- data/test/integration/basic_authentication_and_registration_test.rb +52 -52
- data/test/integration/internal_mapping/basic_authentication_and_registration_test.rb +3 -3
- data/test/integration/internal_mapping/settings_test.rb +9 -9
- data/test/integration/no_mapping/basic_authentication_and_registration_test.rb +3 -3
- data/test/integration/no_mapping/settings_test.rb +9 -9
- data/test/libs/ext_test_unit.rb +30 -30
- data/test/libs/mock_rpx_now.rb +33 -33
- data/test/libs/rails_trickery.rb +40 -40
- data/test/libs/rpxresponse.rb +2 -2
- data/test/libs/user.rb +2 -2
- data/test/libs/user_session.rb +2 -2
- data/test/test_helper.rb +84 -86
- data/test/test_internal_mapping_helper.rb +93 -95
- data/test/unit/acts_as_authentic_settings_test.rb +41 -41
- data/test/unit/session_settings_test.rb +37 -37
- data/test/unit/session_validation_test.rb +15 -15
- data/test/unit/verify_rpx_mock_test.rb +28 -28
- metadata +66 -32
data/test/libs/rails_trickery.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
# The only reason I am doing all of this non sense is becuase the openid_authentication requires that
|
2
|
-
# these constants be present. The only other alternative is to use an entire rails application for testing
|
3
|
-
# which is a little too overboard for this, I think.
|
4
|
-
|
5
|
-
#RAILS_ROOT = ''
|
6
|
-
|
7
|
-
class ActionControllerEx < Authlogic::TestCase::MockController
|
8
|
-
class Request < Authlogic::TestCase::MockRequest
|
9
|
-
def request_method
|
10
|
-
""
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def root_url
|
15
|
-
''
|
16
|
-
end
|
17
|
-
|
18
|
-
def request
|
19
|
-
return @request if defined?(@request)
|
20
|
-
super
|
21
|
-
# Rails does some crazy s#!t with the "method" method. If I don't do this I get a "wrong arguments (0 for 1) error"
|
22
|
-
@request.class.class_eval do
|
23
|
-
def method
|
24
|
-
nil
|
25
|
-
end
|
26
|
-
end
|
27
|
-
@request
|
28
|
-
end
|
29
|
-
|
30
|
-
def url_for(*args)
|
31
|
-
''
|
32
|
-
end
|
33
|
-
|
34
|
-
def redirecting_to
|
35
|
-
@redirect_to
|
36
|
-
end
|
37
|
-
|
38
|
-
def redirect_to(*args)
|
39
|
-
@redirect_to = args
|
40
|
-
end
|
1
|
+
# The only reason I am doing all of this non sense is becuase the openid_authentication requires that
|
2
|
+
# these constants be present. The only other alternative is to use an entire rails application for testing
|
3
|
+
# which is a little too overboard for this, I think.
|
4
|
+
|
5
|
+
#RAILS_ROOT = ''
|
6
|
+
|
7
|
+
class ActionControllerEx < Authlogic::TestCase::MockController
|
8
|
+
class Request < Authlogic::TestCase::MockRequest
|
9
|
+
def request_method
|
10
|
+
""
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def root_url
|
15
|
+
''
|
16
|
+
end
|
17
|
+
|
18
|
+
def request
|
19
|
+
return @request if defined?(@request)
|
20
|
+
super
|
21
|
+
# Rails does some crazy s#!t with the "method" method. If I don't do this I get a "wrong arguments (0 for 1) error"
|
22
|
+
@request.class.class_eval do
|
23
|
+
def method
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
@request
|
28
|
+
end
|
29
|
+
|
30
|
+
def url_for(*args)
|
31
|
+
''
|
32
|
+
end
|
33
|
+
|
34
|
+
def redirecting_to
|
35
|
+
@redirect_to
|
36
|
+
end
|
37
|
+
|
38
|
+
def redirect_to(*args)
|
39
|
+
@redirect_to = args
|
40
|
+
end
|
41
41
|
end
|
data/test/libs/rpxresponse.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
class Rpxresponse < ActiveRecord::Base
|
2
|
-
|
1
|
+
class Rpxresponse < ActiveRecord::Base
|
2
|
+
|
3
3
|
end
|
data/test/libs/user.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
class User < ActiveRecord::Base
|
2
|
-
acts_as_authentic
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
acts_as_authentic
|
3
3
|
end
|
data/test/libs/user_session.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
class UserSession < Authlogic::Session::Base
|
2
|
-
rpx_key RPX_API_KEY
|
1
|
+
class UserSession < Authlogic::Session::Base
|
2
|
+
rpx_key RPX_API_KEY
|
3
3
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,87 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
gem 'test-unit'
|
4
|
-
require
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require "
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
t.string :
|
29
|
-
t.string :
|
30
|
-
t.string :
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
t.
|
37
|
-
t.
|
38
|
-
t.
|
39
|
-
t.string :
|
40
|
-
t.string :
|
41
|
-
t.string :
|
42
|
-
t.string :
|
43
|
-
t.string :
|
44
|
-
t.string :
|
45
|
-
t.string :
|
46
|
-
t.string :
|
47
|
-
t.
|
48
|
-
t.
|
49
|
-
t.
|
50
|
-
t.
|
51
|
-
t.datetime :
|
52
|
-
t.
|
53
|
-
t.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
require "
|
61
|
-
|
62
|
-
require "
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
require
|
68
|
-
|
69
|
-
require
|
70
|
-
require
|
71
|
-
require
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
self.
|
78
|
-
self.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
1
|
+
begin
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'test-unit'
|
4
|
+
require 'test/unit'
|
5
|
+
rescue LoadError
|
6
|
+
# assume using stdlib Test:Unit
|
7
|
+
require 'test/unit'
|
8
|
+
end
|
9
|
+
require 'ext_test_unit'
|
10
|
+
|
11
|
+
require "active_record"
|
12
|
+
require "action_controller"
|
13
|
+
|
14
|
+
ActiveRecord::Schema.verbose = false
|
15
|
+
|
16
|
+
begin
|
17
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
18
|
+
rescue ArgumentError
|
19
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
20
|
+
end
|
21
|
+
|
22
|
+
ActiveRecord::Base.configurations = true
|
23
|
+
ActiveRecord::Schema.define(:version => 1) do
|
24
|
+
|
25
|
+
create_table :rpxresponses do |t|
|
26
|
+
t.string :identifier
|
27
|
+
t.string :provider_name
|
28
|
+
t.string :username
|
29
|
+
t.string :verified_email
|
30
|
+
t.string :display_name
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table :users do |t|
|
34
|
+
t.datetime :created_at
|
35
|
+
t.datetime :updated_at
|
36
|
+
t.integer :lock_version, :default => 0
|
37
|
+
t.string :login
|
38
|
+
t.string :crypted_password
|
39
|
+
t.string :password_salt
|
40
|
+
t.string :persistence_token
|
41
|
+
t.string :single_access_token
|
42
|
+
t.string :perishable_token
|
43
|
+
t.string :rpx_identifier
|
44
|
+
t.string :email
|
45
|
+
t.string :first_name
|
46
|
+
t.string :last_name
|
47
|
+
t.integer :login_count, :default => 0, :null => false
|
48
|
+
t.integer :failed_login_count, :default => 0, :null => false
|
49
|
+
t.datetime :last_request_at
|
50
|
+
t.datetime :current_login_at
|
51
|
+
t.datetime :last_login_at
|
52
|
+
t.string :current_login_ip
|
53
|
+
t.string :last_login_ip
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
require "active_record/fixtures"
|
59
|
+
require "authlogic"
|
60
|
+
require "authlogic/test_case"
|
61
|
+
|
62
|
+
require "rpx_now"
|
63
|
+
RPX_API_KEY = 'abcdefghijklmnopqrstuvwxyz' unless defined? RPX_API_KEY
|
64
|
+
|
65
|
+
require 'authlogic_rpx'
|
66
|
+
|
67
|
+
require 'rails_trickery'
|
68
|
+
require 'rpxresponse'
|
69
|
+
require 'mock_rpx_now'
|
70
|
+
require 'user'
|
71
|
+
require 'user_session'
|
72
|
+
|
73
|
+
class ActiveSupport::TestCase
|
74
|
+
include ActiveRecord::TestFixtures
|
75
|
+
self.fixture_path = File.dirname(__FILE__) + "/fixtures"
|
76
|
+
self.use_transactional_fixtures = false
|
77
|
+
self.use_instantiated_fixtures = false
|
78
|
+
self.pre_loaded_fixtures = false
|
79
|
+
fixtures :all
|
80
|
+
setup :activate_authlogic
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
|
87
85
|
end
|
@@ -1,95 +1,93 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
gem 'test-unit'
|
4
|
-
require
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require "
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
t.string :
|
29
|
-
t.string :
|
30
|
-
t.string :
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
t.
|
37
|
-
t.
|
38
|
-
t.
|
39
|
-
t.string :
|
40
|
-
t.string :
|
41
|
-
t.string :
|
42
|
-
t.string :
|
43
|
-
t.string :
|
44
|
-
t.string :
|
45
|
-
t.string :
|
46
|
-
t.string :
|
47
|
-
t.
|
48
|
-
t.
|
49
|
-
t.
|
50
|
-
t.
|
51
|
-
t.datetime :
|
52
|
-
t.
|
53
|
-
t.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
t.
|
60
|
-
t.
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
require "
|
68
|
-
|
69
|
-
require "
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
require
|
75
|
-
|
76
|
-
require
|
77
|
-
require
|
78
|
-
require
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
self.
|
85
|
-
self.
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
|
1
|
+
begin
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'test-unit'
|
4
|
+
require 'test/unit'
|
5
|
+
rescue LoadError
|
6
|
+
# assume using stdlib Test:Unit
|
7
|
+
require 'test/unit'
|
8
|
+
end
|
9
|
+
require 'ext_test_unit'
|
10
|
+
|
11
|
+
require "active_record"
|
12
|
+
require "action_controller"
|
13
|
+
|
14
|
+
ActiveRecord::Schema.verbose = false
|
15
|
+
|
16
|
+
begin
|
17
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
18
|
+
rescue ArgumentError
|
19
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
20
|
+
end
|
21
|
+
|
22
|
+
ActiveRecord::Base.configurations = true
|
23
|
+
ActiveRecord::Schema.define(:version => 1) do
|
24
|
+
|
25
|
+
create_table :rpxresponses do |t|
|
26
|
+
t.string :identifier
|
27
|
+
t.string :provider_name
|
28
|
+
t.string :username
|
29
|
+
t.string :verified_email
|
30
|
+
t.string :display_name
|
31
|
+
end
|
32
|
+
|
33
|
+
create_table :users do |t|
|
34
|
+
t.datetime :created_at
|
35
|
+
t.datetime :updated_at
|
36
|
+
t.integer :lock_version, :default => 0
|
37
|
+
t.string :login
|
38
|
+
t.string :crypted_password
|
39
|
+
t.string :password_salt
|
40
|
+
t.string :persistence_token
|
41
|
+
t.string :single_access_token
|
42
|
+
t.string :perishable_token
|
43
|
+
t.string :rpx_identifier
|
44
|
+
t.string :email
|
45
|
+
t.string :first_name
|
46
|
+
t.string :last_name
|
47
|
+
t.integer :login_count, :default => 0, :null => false
|
48
|
+
t.integer :failed_login_count, :default => 0, :null => false
|
49
|
+
t.datetime :last_request_at
|
50
|
+
t.datetime :current_login_at
|
51
|
+
t.datetime :last_login_at
|
52
|
+
t.string :current_login_ip
|
53
|
+
t.string :last_login_ip
|
54
|
+
end
|
55
|
+
|
56
|
+
create_table :rpx_identifiers do |t|
|
57
|
+
t.string :identifier
|
58
|
+
t.string :provider_name
|
59
|
+
t.integer :user_id
|
60
|
+
t.timestamps
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
require "active_record/fixtures"
|
66
|
+
require "authlogic"
|
67
|
+
require "authlogic/test_case"
|
68
|
+
|
69
|
+
require "rpx_now"
|
70
|
+
RPX_API_KEY = 'abcdefghijklmnopqrstuvwxyz' unless defined? RPX_API_KEY
|
71
|
+
|
72
|
+
require 'authlogic_rpx'
|
73
|
+
|
74
|
+
require 'rails_trickery'
|
75
|
+
require 'rpxresponse'
|
76
|
+
require 'mock_rpx_now'
|
77
|
+
require 'user'
|
78
|
+
require 'user_session'
|
79
|
+
|
80
|
+
class ActiveSupport::TestCase
|
81
|
+
include ActiveRecord::TestFixtures
|
82
|
+
self.fixture_path = File.dirname(__FILE__) + "/fixtures"
|
83
|
+
self.use_transactional_fixtures = false
|
84
|
+
self.use_instantiated_fixtures = false
|
85
|
+
self.pre_loaded_fixtures = false
|
86
|
+
fixtures :all
|
87
|
+
setup :activate_authlogic
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
|
92
|
+
end
|
93
|
+
|