Permalink
Browse files

deprecate and simplify

  • Loading branch information...
1 parent 5a5de8b commit 840b8c761f56de1e736a100ad3c8fa9de4db50df @raggi committed May 23, 2011
Showing with 27 additions and 37 deletions.
  1. +0 −6 init.rb
  2. +25 −2 lib/openid/store/active_record.rb
  3. +0 −29 lib/openid_store_active_record.rb
  4. +2 −0 test/test_helper.rb
View
6 init.rb
@@ -1,6 +0,0 @@
-# Include hook code here
-
-require File.join([File.dirname(__FILE__), 'lib/store/active_record'])
-require File.join([File.dirname(__FILE__), 'lib/models/openid_abstract'])
-require File.join([File.dirname(__FILE__), 'lib/models/openid_association'])
-require File.join([File.dirname(__FILE__), 'lib/models/openid_nonce'])
View
27 lib/openid/store/active_record.rb
@@ -1,13 +1,12 @@
require 'openid/util'
require 'openid/store/interface'
require 'openid/association'
+require 'openssl'
module OpenID
module Store
class ActiveRecord < Interface
- include OpenidStoreActiveRecord
-
# Put a Association object into storage.
# When implementing a store, don't assume that there are any limitations
# on the character set of the server_url. In particular, expect to see
@@ -91,6 +90,30 @@ def cleanup_nonces
OpenidNonce.delete ids.compact
end
+ private
+
+ def targetize(server_url)
+ OpenSSL::Digest::MD5.hexdigest(server_url)
+ end
+
+ def build_association(open_id_association)
+ OpenID::Association.new(
+ open_id_association.handle,
+ open_id_association.secret,
+ open_id_association.issued_at,
+ open_id_association.lifetime,
+ open_id_association.assoc_type
+ )
+ end
+
+ def create_nonce(server_url, timestamp, salt)
+ open_id_nonce = OpenidNonce.new
+ open_id_nonce.target = targetize(server_url)
+ open_id_nonce.server_url = server_url
+ open_id_nonce.timestamp = timestamp
+ open_id_nonce.save
+ end
+
end
end
end
View
29 lib/openid_store_active_record.rb
@@ -1,29 +0,0 @@
-require 'openssl'
-
-module OpenidStoreActiveRecord
-
- protected
-
- def targetize(server_url)
- OpenSSL::Digest::MD5.hexdigest(server_url)
- end
-
- def build_association(open_id_association)
- OpenID::Association.new(
- open_id_association.handle,
- open_id_association.secret,
- open_id_association.issued_at,
- open_id_association.lifetime,
- open_id_association.assoc_type
- )
- end
-
- def create_nonce(server_url, timestamp, salt)
- open_id_nonce = OpenidNonce.new
- open_id_nonce.target = targetize(server_url)
- open_id_nonce.server_url = server_url
- open_id_nonce.timestamp = timestamp
- open_id_nonce.save
- end
-
-end
View
2 test/test_helper.rb
@@ -1,2 +1,4 @@
+require 'test/unit'
+require 'openid/store/active_record'
require 'active_support'
require 'active_support/test_case'

0 comments on commit 840b8c7

Please sign in to comment.