openid-store-redis 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f88a3ca5708bd46e5b738e919666ab118e1ca7d
4
+ data.tar.gz: e3720cd8b3416fc5d14f2388fd7c0339fe9b6cd8
5
+ SHA512:
6
+ metadata.gz: 29fd0603cb71fa033902865f4ed627759657265af171ee1b6a059917e82b688d6e0672ce8a2bab17473ae36f33c173a6d79ebc37ad2055e86da538938792e3ca
7
+ data.tar.gz: ef0a2548af3def6da106e8cc231233f0448742c5de75afc9ec72a81eeedf0d92a91eac0477716cafced0897c930be5bd2db45c7ee35818e47a3191c367ff3dd6
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.3
5
4
  - 2.0.0
5
+ - 2.1.1
6
6
  - jruby-19mode
7
- - rbx-19mode
7
+ - rbx
data/README.md CHANGED
@@ -48,5 +48,5 @@ argument to store.
48
48
  ## Copyright
49
49
 
50
50
  © Rally Software Development Corp. Released under MIT license, see
51
- [LICENSE](https://github.com/RallySoftware/openid-redis-store/blob/master/LICENSE.txt)
51
+ [LICENSE](https://github.com/RallySoftware/openid-store-redis/blob/master/LICENSE.txt)
52
52
  for details.
@@ -58,17 +58,35 @@ module OpenID
58
58
  end
59
59
  end
60
60
 
61
- def cleanup_nonces
61
+ # Cleanup associations from Redis
62
+ # This iterates over Redis keys, so it's better to rely on TTLs in
63
+ # production environments.
64
+ def cleanup_associations
65
+ remove_keys(':a:*')
62
66
  end
63
67
 
64
- def cleanup
68
+ # Cleanup nonces from Redis
69
+ # This iterates over Redis keys, so it's better to rely on TTLs in
70
+ # production environments.
71
+ def cleanup_nonces
72
+ remove_keys(':n:*')
65
73
  end
66
74
 
67
- def cleanup_associations
75
+ # Cleanup all OpenID data from Redis
76
+ # This iterates over Redis keys, so it's better to rely on TTLs in
77
+ # production environments.
78
+ def cleanup
79
+ remove_keys(':*')
68
80
  end
69
81
 
70
82
  private
71
83
 
84
+ def remove_keys(pattern)
85
+ @redis.keys(prefix + pattern).each do |key|
86
+ @redis.del(key)
87
+ end
88
+ end
89
+
72
90
  def assoc_key(server_url, assoc_handle=nil)
73
91
  key = prefix + ':a:' + server_url
74
92
  if assoc_handle
@@ -1,5 +1,5 @@
1
1
  module OpenID
2
2
  module Store
3
- REDIS_VERSION = "0.1.0"
3
+ REDIS_VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.required_ruby_version = '>= 1.9.3'
22
+
21
23
  spec.add_runtime_dependency "ruby-openid", ">= 2.1.7"
22
24
  spec.add_runtime_dependency "redis", "~> 3.0"
23
25
 
@@ -118,6 +118,63 @@ describe OpenID::Store::Redis do
118
118
  ttl.should eql(OpenID::Nonce.skew + 5)
119
119
  end
120
120
  end
121
+
122
+ describe '#cleanup_nonces' do
123
+ before :each do
124
+ ts, salt = Nonce::split_nonce(Nonce::mk_nonce)
125
+ subject.use_nonce(url, ts.to_i, salt)
126
+ end
127
+
128
+ it 'removes nonces from redis' do
129
+ subject.cleanup_nonces
130
+ redis.keys.should be_empty
131
+ end
132
+
133
+ it 'leaves association data' do
134
+ redis.set 'openid-store:a:url', 'testtest'
135
+ subject.cleanup_nonces
136
+ redis.keys.should have(1).item
137
+ end
138
+ end
139
+
140
+ describe '#cleanup_associations' do
141
+ before :each do
142
+ assoc = association(0)
143
+ redis.set('openid-store:a:' + url + ":" + assoc.handle, Marshal.dump(assoc))
144
+ end
145
+
146
+ it 'removes association data' do
147
+ subject.cleanup_associations
148
+ redis.keys.should be_empty
149
+ end
150
+
151
+ it 'leaves nonce data' do
152
+ ts, salt = Nonce::split_nonce(Nonce::mk_nonce)
153
+ subject.use_nonce(url, ts.to_i, salt)
154
+ subject.cleanup_associations
155
+ redis.keys.should have(1).item
156
+ end
157
+ end
158
+
159
+ describe '#cleanup' do
160
+ before :each do
161
+ ts, salt = Nonce::split_nonce(Nonce::mk_nonce)
162
+ subject.use_nonce(url, ts.to_i, salt)
163
+ assoc = association(0)
164
+ redis.set('openid-store:a:' + url + ":" + assoc.handle, Marshal.dump(assoc))
165
+ end
166
+
167
+ it 'removes redis store data' do
168
+ subject.cleanup
169
+ redis.keys.should be_empty
170
+ end
171
+
172
+ it 'leaves other data around' do
173
+ redis.set 'something-else', 'is still there'
174
+ subject.cleanup
175
+ redis.get('something-else').should == 'is still there'
176
+ end
177
+ end
121
178
  end
122
179
 
123
180
  def association(issued, lifetime=600)
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid-store-redis
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.0
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ville Lautanala
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-08 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- version_requirements: !ruby/object:Gem::Requirement
16
- none: false
17
- requirements:
18
- - - ! '>='
19
- - !ruby/object:Gem::Version
20
- version: 2.1.7
21
14
  name: ruby-openid
22
- prerelease: false
23
15
  requirement: !ruby/object:Gem::Requirement
24
- none: false
25
16
  requirements:
26
- - - ! '>='
17
+ - - ">="
27
18
  - !ruby/object:Gem::Version
28
19
  version: 2.1.7
29
20
  type: :runtime
30
- - !ruby/object:Gem::Dependency
21
+ prerelease: false
31
22
  version_requirements: !ruby/object:Gem::Requirement
32
- none: false
33
23
  requirements:
34
- - - ~>
24
+ - - ">="
35
25
  - !ruby/object:Gem::Version
36
- version: '3.0'
26
+ version: 2.1.7
27
+ - !ruby/object:Gem::Dependency
37
28
  name: redis
38
- prerelease: false
39
29
  requirement: !ruby/object:Gem::Requirement
40
- none: false
41
30
  requirements:
42
- - - ~>
31
+ - - "~>"
43
32
  - !ruby/object:Gem::Version
44
33
  version: '3.0'
45
34
  type: :runtime
46
- - !ruby/object:Gem::Dependency
35
+ prerelease: false
47
36
  version_requirements: !ruby/object:Gem::Requirement
48
- none: false
49
37
  requirements:
50
- - - ~>
38
+ - - "~>"
51
39
  - !ruby/object:Gem::Version
52
- version: '1.3'
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
53
42
  name: bundler
54
- prerelease: false
55
43
  requirement: !ruby/object:Gem::Requirement
56
- none: false
57
44
  requirements:
58
- - - ~>
45
+ - - "~>"
59
46
  - !ruby/object:Gem::Version
60
47
  version: '1.3'
61
48
  type: :development
62
- - !ruby/object:Gem::Dependency
49
+ prerelease: false
63
50
  version_requirements: !ruby/object:Gem::Requirement
64
- none: false
65
51
  requirements:
66
- - - ! '>='
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
69
56
  name: rake
70
- prerelease: false
71
57
  requirement: !ruby/object:Gem::Requirement
72
- none: false
73
58
  requirements:
74
- - - ! '>='
59
+ - - ">="
75
60
  - !ruby/object:Gem::Version
76
61
  version: '0'
77
62
  type: :development
78
- - !ruby/object:Gem::Dependency
63
+ prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
80
- none: false
81
65
  requirements:
82
- - - ~>
66
+ - - ">="
83
67
  - !ruby/object:Gem::Version
84
- version: '2.13'
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
85
70
  name: rspec
86
- prerelease: false
87
71
  requirement: !ruby/object:Gem::Requirement
88
- none: false
89
72
  requirements:
90
- - - ~>
73
+ - - "~>"
91
74
  - !ruby/object:Gem::Version
92
75
  version: '2.13'
93
76
  type: :development
94
- - !ruby/object:Gem::Dependency
77
+ prerelease: false
95
78
  version_requirements: !ruby/object:Gem::Requirement
96
- none: false
97
79
  requirements:
98
- - - ! '>='
80
+ - - "~>"
99
81
  - !ruby/object:Gem::Version
100
- version: '0'
82
+ version: '2.13'
83
+ - !ruby/object:Gem::Dependency
101
84
  name: mock_redis
102
- prerelease: false
103
85
  requirement: !ruby/object:Gem::Requirement
104
- none: false
105
86
  requirements:
106
- - - ! '>='
87
+ - - ">="
107
88
  - !ruby/object:Gem::Version
108
89
  version: '0'
109
90
  type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
110
97
  description: Use Redis to store OpenID associations and nonces with ruby-openid
111
98
  email:
112
99
  - lautis@gmail.com
@@ -114,8 +101,8 @@ executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - .gitignore
118
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".travis.yml"
119
106
  - Gemfile
120
107
  - LICENSE.txt
121
108
  - README.md
@@ -129,33 +116,26 @@ files:
129
116
  homepage: ''
130
117
  licenses:
131
118
  - MIT
119
+ metadata: {}
132
120
  post_install_message:
133
121
  rdoc_options: []
134
122
  require_paths:
135
123
  - lib
136
124
  required_ruby_version: !ruby/object:Gem::Requirement
137
- none: false
138
125
  requirements:
139
- - - ! '>='
126
+ - - ">="
140
127
  - !ruby/object:Gem::Version
141
- segments:
142
- - 0
143
- hash: 881735339377992324
144
- version: '0'
128
+ version: 1.9.3
145
129
  required_rubygems_version: !ruby/object:Gem::Requirement
146
- none: false
147
130
  requirements:
148
- - - ! '>='
131
+ - - ">="
149
132
  - !ruby/object:Gem::Version
150
- segments:
151
- - 0
152
- hash: 881735339377992324
153
133
  version: '0'
154
134
  requirements: []
155
135
  rubyforge_project:
156
- rubygems_version: 1.8.23
136
+ rubygems_version: 2.2.2
157
137
  signing_key:
158
- specification_version: 3
138
+ specification_version: 4
159
139
  summary: A Redis storage backend for ruby-openid
160
140
  test_files:
161
141
  - spec/openid/store/redis_spec.rb