omf_common 6.0.7.1 → 6.0.8.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,43 +16,41 @@ describe OmfCommon::Auth::CertificateStore do
16
16
  end
17
17
 
18
18
  it "must register certificate instance" do
19
- cert = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
19
+ cert = OmfCommon::Auth::Certificate.create_from_pem(File.read "#{@private_folder}/1st_level.pem")
20
20
 
21
- OmfCommon::Auth::CertificateStore.instance.register(cert, 'ca1')
22
-
23
- OmfCommon::Auth::CertificateStore.instance.cert_for("ca1").must_equal cert
21
+ OmfCommon::Auth::CertificateStore.instance.register_trusted(cert)
22
+ OmfCommon::Auth::CertificateStore.instance.cert_for("/C=AU/ST=NSW/L=Sydney/O=NICTA/CN=ROOT CA/emailAddress= ").must_equal cert
24
23
  end
25
24
 
26
25
  it "must verify certificate aginst store" do
27
26
  # 2 level CAs
28
- cert_1 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
29
- cert_2 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/2nd_level.pem")
30
- cert_3 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/3rd_level.pem")
31
-
32
-
33
- # 1 level CA
34
-
35
- cert_4 = OmfCommon::Auth::Certificate.create(nil, 'omf_ca', 'ca', 'omf')
36
- key = OpenSSL::PKey::RSA.new(2048)
37
- cert_5 = cert_4.create_for('my_add', 'bob', 'my_resource', 'omf', 365, key.public_key)
27
+ cert_1 = OmfCommon::Auth::Certificate.create_from_pem(File.read "#{@private_folder}/1st_level.pem")
28
+ cert_2 = OmfCommon::Auth::Certificate.create_from_pem(File.read "#{@private_folder}/2nd_level.pem")
29
+ cert_3 = OmfCommon::Auth::Certificate.create_from_pem(File.read "#{@private_folder}/3rd_level.pem")
38
30
 
39
31
  OmfCommon::Auth::CertificateStore.instance.verify(cert_2.to_x509).must_equal false
40
32
 
41
- OmfCommon::Auth::CertificateStore.instance.register(cert_1)
33
+ OmfCommon::Auth::CertificateStore.instance.register_trusted(cert_1)
34
+
42
35
  OmfCommon::Auth::CertificateStore.instance.verify(cert_2.to_x509).must_equal true
43
36
  OmfCommon::Auth::CertificateStore.instance.verify(cert_3.to_x509).must_equal false
44
37
 
45
- OmfCommon::Auth::CertificateStore.instance.register(cert_2)
38
+ OmfCommon::Auth::CertificateStore.instance.register_trusted(cert_2)
39
+
46
40
  OmfCommon::Auth::CertificateStore.instance.verify(cert_3.to_x509).must_equal true
47
- OmfCommon::Auth::CertificateStore.instance.verify(cert_5.to_x509).must_equal false
48
41
 
49
- OmfCommon::Auth::CertificateStore.instance.register(cert_4)
42
+ # 1 level CA
43
+ cert_4 = OmfCommon::Auth::Certificate.create_root
44
+ key = OpenSSL::PKey::RSA.new(2048)
45
+ cert_5 = cert_4.create_for_resource('my_add', :my_resource)
46
+
47
+ OmfCommon::Auth::CertificateStore.instance.verify(cert_4.to_x509).must_equal true
50
48
  OmfCommon::Auth::CertificateStore.instance.verify(cert_5.to_x509).must_equal true
51
49
  end
52
50
 
53
51
  it "wont die if registering same cert again" do
54
- cert_1 = OmfCommon::Auth::Certificate.create_from_x509(File.read "#{@private_folder}/1st_level.pem")
55
- OmfCommon::Auth::CertificateStore.instance.register(cert_1)
56
- OmfCommon::Auth::CertificateStore.instance.register(cert_1)
52
+ cert_1 = OmfCommon::Auth::Certificate.create_from_pem(File.read "#{@private_folder}/1st_level.pem")
53
+ OmfCommon::Auth::CertificateStore.instance.register_trusted(cert_1)
54
+ OmfCommon::Auth::CertificateStore.instance.register_trusted(cert_1)
57
55
  end
58
56
  end
@@ -4,6 +4,7 @@
4
4
  # By downloading or using this software you accept the terms and the liability disclaimer in the License.
5
5
 
6
6
  require 'test_helper'
7
+ require 'monitor'
7
8
  require 'fixture/pubsub'
8
9
 
9
10
  require 'omf_common/comm/xmpp/communicator'
@@ -15,6 +16,9 @@ describe OmfCommon::Comm::XMPP::Communicator do
15
16
  @stream.expect(:send, true, [Blather::Stanza])
16
17
  @client.post_init @stream, Blather::JID.new('bob@example.com')
17
18
  @xmpp = OmfCommon::Comm::XMPP::Communicator.new
19
+ @xmpp.instance_eval do
20
+ @lock = Monitor.new
21
+ end
18
22
  end
19
23
 
20
24
  describe "when communicating to xmpp server (via mocking)" do
@@ -35,7 +39,6 @@ describe OmfCommon::Comm::XMPP::Communicator do
35
39
  Blather::Client.stub :new, @client do
36
40
  @stream.expect(:close_connection_after_writing, true)
37
41
  @xmpp.disconnect
38
- @stream.verify
39
42
  end
40
43
  end
41
44
 
@@ -153,8 +153,8 @@ describe OmfCommon::Message::XML::Message do
153
153
  OmfCommon.stubs(:comm).returns(comm)
154
154
  comm.expects(:create_topic).returns(topic)
155
155
 
156
- cert = OmfCommon::Auth::Certificate.create(nil, 'sa', 'auth')
157
- bob_cert = cert.create_for('bob', 'bob', 'bob')
156
+ root_cert = OmfCommon::Auth::Certificate.create_root
157
+ bob_cert = root_cert.create_for_resource('bob', :bob)
158
158
 
159
159
  message = Message::XML::Message.create(:create,
160
160
  { type: 'bob', p1: 'p1_value'},
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.7.1
4
+ version: 6.0.8.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NICTA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: em-minitest-spec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,42 +42,42 @@ dependencies:
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mocha
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
@@ -164,6 +164,48 @@ dependencies:
164
164
  - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: 1.7.7
167
+ - !ruby/object:Gem::Dependency
168
+ name: json-jwt
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: amqp
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ! '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ! '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: uuidtools
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ! '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ! '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
167
209
  description: Common library of OMF, a generic framework for controlling and managing
168
210
  networking testbeds.
169
211
  email:
@@ -180,11 +222,13 @@ files:
180
222
  - Rakefile
181
223
  - bin/file_broadcaster.rb
182
224
  - bin/file_receiver.rb
225
+ - bin/omf_cert.rb
183
226
  - bin/omf_keygen
184
227
  - bin/omf_monitor_topic
185
228
  - bin/omf_send_configure
186
229
  - bin/omf_send_create
187
230
  - bin/omf_send_request
231
+ - example/auth_test.rb
188
232
  - example/engine_alt.rb
189
233
  - example/ls_app.yaml
190
234
  - example/viz/garage_monitor.rb
@@ -197,10 +241,13 @@ files:
197
241
  - lib/omf_common/auth.rb
198
242
  - lib/omf_common/auth/certificate.rb
199
243
  - lib/omf_common/auth/certificate_store.rb
244
+ - lib/omf_common/auth/jwt_authenticator.rb
245
+ - lib/omf_common/auth/pdp/test_pdp.rb
200
246
  - lib/omf_common/auth/ssh_pub_key_convert.rb
201
247
  - lib/omf_common/comm.rb
202
248
  - lib/omf_common/comm/amqp/amqp_communicator.rb
203
249
  - lib/omf_common/comm/amqp/amqp_file_transfer.rb
250
+ - lib/omf_common/comm/amqp/amqp_mp.rb
204
251
  - lib/omf_common/comm/amqp/amqp_topic.rb
205
252
  - lib/omf_common/comm/local/local_communicator.rb
206
253
  - lib/omf_common/comm/local/local_topic.rb
@@ -229,6 +276,8 @@ files:
229
276
  - test/fixture/1st_level.pem
230
277
  - test/fixture/2nd_level.pem
231
278
  - test/fixture/3rd_level.pem
279
+ - test/fixture/alice-cert.pem
280
+ - test/fixture/alice-key.pem
232
281
  - test/fixture/omf_test.cert.pem
233
282
  - test/fixture/omf_test.pem
234
283
  - test/fixture/omf_test.pub
@@ -258,40 +307,18 @@ require_paths:
258
307
  - lib
259
308
  required_ruby_version: !ruby/object:Gem::Requirement
260
309
  requirements:
261
- - - '>='
310
+ - - ! '>='
262
311
  - !ruby/object:Gem::Version
263
312
  version: 1.9.3
264
313
  required_rubygems_version: !ruby/object:Gem::Requirement
265
314
  requirements:
266
- - - '>='
315
+ - - ! '>'
267
316
  - !ruby/object:Gem::Version
268
- version: '0'
317
+ version: 1.3.1
269
318
  requirements: []
270
319
  rubyforge_project: omf_common
271
- rubygems_version: 2.0.6
320
+ rubygems_version: 2.0.7
272
321
  signing_key:
273
322
  specification_version: 4
274
323
  summary: Common library of OMF
275
- test_files:
276
- - test/fixture/1st_level.pem
277
- - test/fixture/2nd_level.pem
278
- - test/fixture/3rd_level.pem
279
- - test/fixture/omf_test.cert.pem
280
- - test/fixture/omf_test.pem
281
- - test/fixture/omf_test.pub
282
- - test/fixture/omf_test.pub.pem
283
- - test/fixture/pubsub.rb
284
- - test/fixture/rc.pem
285
- - test/fixture/root.pem
286
- - test/omf_common/auth/certificate_spec.rb
287
- - test/omf_common/auth/certificate_store_spec.rb
288
- - test/omf_common/auth/ssh_pub_key_convert_spec.rb
289
- - test/omf_common/comm/topic_spec.rb
290
- - test/omf_common/comm/xmpp/communicator_spec.rb
291
- - test/omf_common/comm/xmpp/topic_spec.rb
292
- - test/omf_common/comm_spec.rb
293
- - test/omf_common/command_spec.rb
294
- - test/omf_common/core_ext/string_spec.rb
295
- - test/omf_common/message/xml/message_spec.rb
296
- - test/omf_common/message_spec.rb
297
- - test/test_helper.rb
324
+ test_files: []