openid_mongodb_store 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/openid_mongodb_store/store.rb +12 -12
- data/openid_mongodb_store.gemspec +7 -4
- metadata +41 -9
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/samsm/openid_mongodb_store"
|
12
12
|
gem.authors = ["Sam Schenkman-Moore"]
|
13
13
|
gem.add_development_dependency "yard", ">= 0"
|
14
|
+
gem.add_development_dependency "mongo", ">= 1.0.3"
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -3,23 +3,23 @@ require 'openid/store/interface'
|
|
3
3
|
|
4
4
|
class OpenidMongodbStore::Store < OpenID::Store::Interface
|
5
5
|
include OpenidMongodbStore
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(db = nil)
|
8
8
|
OpenidMongodbStore.database = db
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def associations
|
12
12
|
@@associations ||= OpenidMongodbStore.database.collection('openid_mongo_store_associations')
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def nonces
|
16
16
|
@@nonces ||= OpenidMongodbStore.database.collection('openid_mongo_store_nonces')
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def store_association(server_url, association)
|
20
20
|
remove_association(server_url, association.handle)
|
21
|
-
|
22
|
-
secret =
|
21
|
+
|
22
|
+
secret = BSON::Binary.new(association.secret)
|
23
23
|
associations.insert('server_url' => server_url,
|
24
24
|
'handle' => association.handle,
|
25
25
|
'secret' => secret,
|
@@ -34,7 +34,7 @@ class OpenidMongodbStore::Store < OpenID::Store::Interface
|
|
34
34
|
else
|
35
35
|
associations.find({'server_url' => server_url, 'handle' => handle})
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
assoc_records = assocs.collect {|a| a }
|
39
39
|
|
40
40
|
# TODO: Removed .reverse here, make sure that was reasonable.
|
@@ -50,15 +50,15 @@ class OpenidMongodbStore::Store < OpenID::Store::Interface
|
|
50
50
|
return openid_association
|
51
51
|
end
|
52
52
|
end if assoc_records.any? # <- may not be needed
|
53
|
-
|
53
|
+
|
54
54
|
# Fail if there isn't an acceptable association
|
55
55
|
return nil
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def remove_association(server_url, handle)
|
59
59
|
associations.remove({'server_url'=> server_url, 'handle' => handle})
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
def use_nonce(server_url, timestamp, salt)
|
63
63
|
return false if nonces.find_one({'server_url'=> server_url,
|
64
64
|
'timestamp' => timestamp,
|
@@ -67,7 +67,7 @@ class OpenidMongodbStore::Store < OpenID::Store::Interface
|
|
67
67
|
nonces.insert({'server_url' => server_url, 'timestamp' => timestamp, 'salt' => salt})
|
68
68
|
return true
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def cleanup_nonces
|
72
72
|
now = Time.now.to_i
|
73
73
|
nonces.remove({'timestamp' => {'$gt'=> (now + OpenID::Nonce.skew),
|
@@ -79,5 +79,5 @@ class OpenidMongodbStore::Store < OpenID::Store::Interface
|
|
79
79
|
# Association.delete_all(:expire_at => {'$gt' => now})
|
80
80
|
associations.remove('expire_at' => {'$gt' => now})
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{openid_mongodb_store}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sam Schenkman-Moore"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-07-04}
|
13
13
|
s.description = %q{Like the ActiveRecord Store, but for Mongo.}
|
14
14
|
s.email = %q{samsm@samsm.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = %q{http://github.com/samsm/openid_mongodb_store}
|
34
34
|
s.rdoc_options = ["--charset=UTF-8"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.
|
36
|
+
s.rubygems_version = %q{1.3.7}
|
37
37
|
s.summary = %q{An adaptor for storing OpenID nonces and associations with Mongo. Uses 10gen's Mongo Ruby library so should work with MongoMapper, Mongoid, and others.}
|
38
38
|
s.test_files = [
|
39
39
|
"test/helper.rb",
|
@@ -44,13 +44,16 @@ Gem::Specification.new do |s|
|
|
44
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
45
|
s.specification_version = 3
|
46
46
|
|
47
|
-
if Gem::Version.new(Gem::
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
48
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<mongo>, [">= 1.0.3"])
|
49
50
|
else
|
50
51
|
s.add_dependency(%q<yard>, [">= 0"])
|
52
|
+
s.add_dependency(%q<mongo>, [">= 1.0.3"])
|
51
53
|
end
|
52
54
|
else
|
53
55
|
s.add_dependency(%q<yard>, [">= 0"])
|
56
|
+
s.add_dependency(%q<mongo>, [">= 1.0.3"])
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openid_mongodb_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Sam Schenkman-Moore
|
@@ -9,19 +15,39 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-07-04 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: yard
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
23
32
|
version: "0"
|
24
|
-
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: mongo
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 17
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
- 3
|
48
|
+
version: 1.0.3
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
25
51
|
description: Like the ActiveRecord Store, but for Mongo.
|
26
52
|
email: samsm@samsm.com
|
27
53
|
executables: []
|
@@ -54,21 +80,27 @@ rdoc_options:
|
|
54
80
|
require_paths:
|
55
81
|
- lib
|
56
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
57
84
|
requirements:
|
58
85
|
- - ">="
|
59
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
60
90
|
version: "0"
|
61
|
-
version:
|
62
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
63
93
|
requirements:
|
64
94
|
- - ">="
|
65
95
|
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
66
99
|
version: "0"
|
67
|
-
version:
|
68
100
|
requirements: []
|
69
101
|
|
70
102
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.3.
|
103
|
+
rubygems_version: 1.3.7
|
72
104
|
signing_key:
|
73
105
|
specification_version: 3
|
74
106
|
summary: An adaptor for storing OpenID nonces and associations with Mongo. Uses 10gen's Mongo Ruby library so should work with MongoMapper, Mongoid, and others.
|