Empact-authlogic_rpx 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{Empact-authlogic_rpx}
8
- s.version = "1.1.7"
8
+ s.version = "1.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Gallagher / tardate"]
12
- s.date = %q{2010-05-22}
12
+ s.date = %q{2010-07-03}
13
13
  s.description = %q{Authlogic extension/plugin that provides RPX (rpxnow.com) authentication support}
14
14
  s.email = %q{gallagher.paul@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -60,7 +60,7 @@ Gem::Specification.new do |s|
60
60
  s.homepage = %q{http://github.com/tardate/authlogic_rpx}
61
61
  s.rdoc_options = ["--charset=UTF-8"]
62
62
  s.require_paths = ["lib"]
63
- s.rubygems_version = %q{1.3.6}
63
+ s.rubygems_version = %q{1.3.7}
64
64
  s.summary = %q{Authlogic plug-in for RPX support}
65
65
  s.test_files = [
66
66
  "test/integration/basic_authentication_and_registration_test.rb",
@@ -87,7 +87,7 @@ Gem::Specification.new do |s|
87
87
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
88
88
  s.specification_version = 3
89
89
 
90
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
90
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
91
91
  s.add_runtime_dependency(%q<Empact-authlogic>, [">= 2.1.3"])
92
92
  s.add_runtime_dependency(%q<Empact-rpx_now>, [">= 0.6.12"])
93
93
  else
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.7
1
+ 1.1.8
@@ -32,6 +32,7 @@ module AuthlogicRpx
32
32
  end
33
33
  alias_method :account_merge_enabled=,:account_merge_enabled
34
34
 
35
+
35
36
  # account_mapping_mode is used to explicitly set/override the mapping behaviour.
36
37
  #
37
38
  # * <tt>Default:</tt> :auto
@@ -77,18 +78,30 @@ module AuthlogicRpx
77
78
 
78
79
  module Methods
79
80
 
80
- # Mix-in the required methods based on mapping mode
81
- #
81
+ # Set up some simple validations
82
82
  def self.included(klass)
83
83
  klass.class_eval do
84
84
 
85
85
  case
86
86
  when using_no_mapping?
87
- include AuthlogicRpx::MethodSet_NoMapping
87
+ alias_method :using_rpx?, :using_rpx__nomap?
88
+ alias_method :add_rpx_identifier, :add_rpx_identifier__nomap
89
+ alias_method :identified_by?, :identified_by__nomap?
90
+ alias_method :merge_user_id, :merge_user_id__nomap
91
+
92
+ # Uses default find_by_rpx_identifier class method
93
+
94
+ # Add an rpx_identifier collection method
95
+ def rpx_identifiers
96
+ [{ :identifier => rpx_identifier, :provider_name => "Unknown" }]
97
+ end
88
98
 
89
99
  when using_internal_mapping?
90
- include AuthlogicRpx::MethodSet_InternalMapping
91
- has_many :rpx_identifiers, :class_name => 'RPXIdentifier', :dependent => :destroy
100
+ alias_method :using_rpx?, :using_rpx__internal?
101
+ alias_method :add_rpx_identifier, :add_rpx_identifier__internal
102
+ alias_method :identified_by?, :identified_by__internal?
103
+ alias_method :merge_user_id, :merge_user_id__internal
104
+ has_many :rpx_identifiers, :class_name => 'RPXIdentifier', :validate => false, :dependent => :destroy
92
105
 
93
106
  # Add custom find_by_rpx_identifier class method
94
107
  #
@@ -114,10 +127,9 @@ module AuthlogicRpx
114
127
  raise AuthlogicRpx::ActsAsAuthentic::ConfigurationError.new( "invalid or unsupported account_mapping_mode" )
115
128
  end
116
129
 
117
- # Set up some fundamental conditional validations
118
- validates_length_of_password_field_options validates_length_of_password_field_options.merge(:if => :validate_password_not_rpx?)
119
- validates_confirmation_of_password_field_options validates_confirmation_of_password_field_options.merge(:if => :validate_password_not_rpx?)
120
- validates_length_of_password_confirmation_field_options validates_length_of_password_confirmation_field_options.merge(:if => :validate_password_not_rpx?)
130
+ validates_length_of_password_field_options validates_length_of_password_field_options.merge(:if => :validate_password_with_rpx?)
131
+ validates_confirmation_of_password_field_options validates_confirmation_of_password_field_options.merge(:if => :validate_password_with_rpx?)
132
+ validates_length_of_password_confirmation_field_options validates_length_of_password_confirmation_field_options.merge(:if => :validate_password_with_rpx?)
121
133
 
122
134
  before_validation :adding_rpx_identifier
123
135
  end
@@ -130,11 +142,13 @@ module AuthlogicRpx
130
142
  end
131
143
  end
132
144
 
133
- # support a block given to the save
134
- def save(perform_validation = true, &block)
135
- result = super perform_validation
136
- yield(result) if block_given?
137
- result
145
+ # test if account it using RPX authentication
146
+ # aliased to using_rpx based on authlogic_rpx configuration mode
147
+ def using_rpx__nomap?
148
+ !rpx_identifier.blank?
149
+ end
150
+ def using_rpx__internal?
151
+ !rpx_identifiers.empty?
138
152
  end
139
153
 
140
154
  # test if account it using normal password authentication
@@ -142,11 +156,30 @@ module AuthlogicRpx
142
156
  !send(crypted_password_field).blank?
143
157
  end
144
158
 
159
+ # adds RPX identification to the instance.
160
+ # Abstracts how the RPX identifier is added to allow for multiplicity of underlying implementations
161
+ # aliased to add_rpx_identifier based on authlogic_rpx configuration mode
162
+ def add_rpx_identifier__nomap( rpx_id, rpx_provider_name )
163
+ self.rpx_identifier = rpx_id
164
+ #TODO: make rpx_provider_name a std param?
165
+ end
166
+ def add_rpx_identifier__internal( rpx_id, rpx_provider_name )
167
+ self.rpx_identifiers.build(:identifier => rpx_id, :provider_name => rpx_provider_name )
168
+ end
169
+
170
+ # Checks if given identifier is an identity for this account
171
+ # aliased to identified_by based on authlogic_rpx configuration mode
172
+ def identified_by__nomap?( id )
173
+ self.rpx_identifier == id
174
+ end
175
+ def identified_by__internal?( id )
176
+ self.rpx_identifiers.find_by_identifier( id )
177
+ end
145
178
 
146
179
  private
147
180
 
148
- # tests if password authentication should be checked instead of rpx (i.e. if rpx is enabled but not used by this user)
149
- def validate_password_not_rpx?
181
+ # tests if password authentication should be checked: if rpx is enabled (but not used by this user)
182
+ def validate_password_with_rpx?
150
183
  !using_rpx? && require_password?
151
184
  end
152
185
 
@@ -194,6 +227,19 @@ module AuthlogicRpx
194
227
  end
195
228
  end
196
229
 
230
+ # merge_user_id is an internal method used to merge the actual RPX identifiers
231
+ # aliased to merge_user_id based on authlogic_rpx configuration mode
232
+ def merge_user_id__nomap( from_user )
233
+ self.rpx_identifier = from_user.rpx_identifier
234
+ from_user.rpx_identifier = nil
235
+ from_user.save
236
+ from_user.reload
237
+ end
238
+ def merge_user_id__internal( from_user )
239
+ self.rpx_identifiers << from_user.rpx_identifiers
240
+ from_user.reload
241
+ end
242
+
197
243
 
198
244
  # map_added_rpx_data maps additional fields from the RPX response into the user object during the "add RPX to existing account" process.
199
245
  # Override this in your user model to perform field mapping as may be desired
@@ -227,78 +273,4 @@ module AuthlogicRpx
227
273
 
228
274
  end
229
275
  end
230
-
231
- # Mix-in collection of methods that are specific to no-mapping mode of operation
232
- #
233
- module MethodSet_NoMapping
234
- # test if account it using RPX authentication
235
- #
236
- def using_rpx?
237
- !rpx_identifier.blank?
238
- end
239
-
240
- # adds RPX identification to the instance.
241
- # Abstracts how the RPX identifier is added to allow for multiplicity of underlying implementations
242
- #
243
- def add_rpx_identifier( rpx_id, rpx_provider_name )
244
- self.rpx_identifier = rpx_id
245
- #TODO: make rpx_provider_name a std param?
246
- end
247
-
248
- # Checks if given identifier is an identity for this account
249
- #
250
- def identified_by?( id )
251
- self.rpx_identifier == id
252
- end
253
-
254
- # merge_user_id is an internal method used to merge the actual RPX identifiers
255
- #
256
- def merge_user_id( from_user )
257
- self.rpx_identifier = from_user.rpx_identifier
258
- from_user.rpx_identifier = nil
259
- from_user.save
260
- from_user.reload
261
- end
262
-
263
- # Uses default find_by_rpx_identifier class method
264
-
265
- # Add an rpx_identifier collection method
266
- def rpx_identifiers
267
- [{ :identifier => rpx_identifier, :provider_name => "Unknown" }]
268
- end
269
- end
270
-
271
-
272
- # Mix-in collection of methods that are specific to internal mapping mode of operation
273
- #
274
- module MethodSet_InternalMapping
275
- # test if account it using RPX authentication
276
- #
277
- def using_rpx?
278
- !rpx_identifiers.empty?
279
- end
280
-
281
- # adds RPX identification to the instance.
282
- # Abstracts how the RPX identifier is added to allow for multiplicity of underlying implementations
283
- #
284
- def add_rpx_identifier( rpx_id, rpx_provider_name )
285
- self.rpx_identifiers.build(:identifier => rpx_id, :provider_name => rpx_provider_name )
286
- end
287
-
288
- # Checks if given identifier is an identity for this account
289
- #
290
- def identified_by?( id )
291
- self.rpx_identifiers.find_by_identifier( id )
292
- end
293
-
294
- # merge_user_id is an internal method used to merge the actual RPX identifiers
295
- #
296
- def merge_user_id( from_user )
297
- self.rpx_identifiers << from_user.rpx_identifiers
298
- from_user.reload
299
- end
300
-
301
-
302
- end
303
-
304
276
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Empact-authlogic_rpx
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 3
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 7
9
- version: 1.1.7
9
+ - 8
10
+ version: 1.1.8
10
11
  platform: ruby
11
12
  authors:
12
13
  - Paul Gallagher / tardate
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-22 00:00:00 -04:00
18
+ date: 2010-07-03 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: Empact-authlogic
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 2
29
32
  - 1
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: Empact-rpx_now
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 31
41
46
  segments:
42
47
  - 0
43
48
  - 6
@@ -104,23 +109,27 @@ rdoc_options:
104
109
  require_paths:
105
110
  - lib
106
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
107
113
  requirements:
108
114
  - - ">="
109
115
  - !ruby/object:Gem::Version
116
+ hash: 3
110
117
  segments:
111
118
  - 0
112
119
  version: "0"
113
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
114
122
  requirements:
115
123
  - - ">="
116
124
  - !ruby/object:Gem::Version
125
+ hash: 3
117
126
  segments:
118
127
  - 0
119
128
  version: "0"
120
129
  requirements: []
121
130
 
122
131
  rubyforge_project:
123
- rubygems_version: 1.3.6
132
+ rubygems_version: 1.3.7
124
133
  signing_key:
125
134
  specification_version: 3
126
135
  summary: Authlogic plug-in for RPX support