saml_idp 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,27 @@ module SamlIdp
16
16
  Saml::XML::Namespaces::AuthnContext::ClassRef::PASSWORD
17
17
  }
18
18
  let(:expiry) { 3 * 60 * 60 }
19
+ let (:encryption_opts) do
20
+ {
21
+ cert: Default::X509_CERTIFICATE,
22
+ block_encryption: 'aes256-cbc',
23
+ key_transport: 'rsa-oaep-mgf1p',
24
+ }
25
+ end
26
+ let(:subject_encrypted) { described_class.new(reference_id,
27
+ response_id,
28
+ issuer_uri,
29
+ name_id,
30
+ audience_uri,
31
+ saml_request_id,
32
+ saml_acs_url,
33
+ algorithm,
34
+ authn_context_classref,
35
+ expiry,
36
+ encryption_opts
37
+ )
38
+ }
39
+
19
40
  subject { described_class.new(reference_id,
20
41
  response_id,
21
42
  issuer_uri,
@@ -32,5 +53,16 @@ module SamlIdp
32
53
  it "has a valid build" do
33
54
  subject.build.should be_present
34
55
  end
56
+
57
+ it "builds encrypted" do
58
+ subject_encrypted.build.should_not match(audience_uri)
59
+ encoded_xml = subject_encrypted.build
60
+ resp_settings = saml_settings(saml_acs_url)
61
+ resp_settings.private_key = Default::SECRET_KEY
62
+ resp_settings.issuer = audience_uri
63
+ saml_resp = OneLogin::RubySaml::Response.new(encoded_xml, settings: resp_settings)
64
+ saml_resp.soft = false
65
+ saml_resp.is_valid?.should == true
66
+ end
35
67
  end
36
68
  end
@@ -1,3 +1,5 @@
1
+ require 'saml_idp/logout_request_builder'
2
+
1
3
  module SamlRequestMacros
2
4
 
3
5
  def make_saml_request(requested_saml_acs_url = "https://foo.example.com/saml/consume")
@@ -6,6 +8,18 @@ module SamlRequestMacros
6
8
  CGI.unescape(auth_url.split("=").last)
7
9
  end
8
10
 
11
+ def make_saml_logout_request(requested_saml_logout_url = 'https://foo.example.com/saml/logout')
12
+ request_builder = SamlIdp::LogoutRequestBuilder.new(
13
+ 'some_response_id',
14
+ 'http://example.com',
15
+ requested_saml_logout_url,
16
+ 'some_name_id',
17
+ 'abc123index',
18
+ OpenSSL::Digest::SHA256
19
+ )
20
+ request_builder.encoded
21
+ end
22
+
9
23
  def saml_settings(saml_acs_url = "https://foo.example.com/saml/consume")
10
24
  settings = OneLogin::RubySaml::Settings.new
11
25
  settings.assertion_consumer_service_url = saml_acs_url
@@ -16,4 +30,10 @@ module SamlRequestMacros
16
30
  settings
17
31
  end
18
32
 
33
+ def print_pretty_xml(xml_string)
34
+ doc = REXML::Document.new xml_string
35
+ outbuf = ""
36
+ doc.write(outbuf, 1)
37
+ puts outbuf
38
+ end
19
39
  end
@@ -116,7 +116,8 @@ module SamlIdp
116
116
 
117
117
  it "be able to validate a good response" do
118
118
  Timecop.freeze Time.parse('2012-11-28 17:55:00 UTC') do
119
- response.validate!.should be_truthy
119
+ response.stub(:validate_subject_confirmation).and_return(true)
120
+ response.should be_is_valid
120
121
  end
121
122
  end
122
123
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml_idp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-03 00:00:00.000000000 Z
12
+ date: 2016-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: '0.8'
149
+ version: '1.2'
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: '0.8'
157
+ version: '1.2'
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: rails
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -203,6 +203,22 @@ dependencies:
203
203
  - - ! '>='
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
+ - !ruby/object:Gem::Dependency
207
+ name: xmlenc
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: 0.6.4
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: 0.6.4
206
222
  description: SAML IdP (Identity Provider) library in ruby
207
223
  email: jon.phenow@sportngin.com
208
224
  executables: []
@@ -219,9 +235,13 @@ files:
219
235
  - lib/saml_idp/configurator.rb
220
236
  - lib/saml_idp/controller.rb
221
237
  - lib/saml_idp/default.rb
238
+ - lib/saml_idp/encryptor.rb
222
239
  - lib/saml_idp/engine.rb
223
240
  - lib/saml_idp/hashable.rb
224
241
  - lib/saml_idp/incoming_metadata.rb
242
+ - lib/saml_idp/logout_builder.rb
243
+ - lib/saml_idp/logout_request_builder.rb
244
+ - lib/saml_idp/logout_response_builder.rb
225
245
  - lib/saml_idp/metadata_builder.rb
226
246
  - lib/saml_idp/name_id_formatter.rb
227
247
  - lib/saml_idp/persisted_metadata.rb
@@ -246,6 +266,9 @@ files:
246
266
  - spec/lib/saml_idp/attribute_decorator_spec.rb
247
267
  - spec/lib/saml_idp/configurator_spec.rb
248
268
  - spec/lib/saml_idp/controller_spec.rb
269
+ - spec/lib/saml_idp/encryptor_spec.rb
270
+ - spec/lib/saml_idp/logout_request_builder_spec.rb
271
+ - spec/lib/saml_idp/logout_response_builder_spec.rb
249
272
  - spec/lib/saml_idp/metadata_builder_spec.rb
250
273
  - spec/lib/saml_idp/name_id_formatter_spec.rb
251
274
  - spec/lib/saml_idp/request_spec.rb
@@ -349,6 +372,14 @@ post_install_message: ! 'If you''re just recently updating saml_idp - please be
349
372
 
350
373
  defaults in a Production environment. Post any issues you to github.
351
374
 
375
+
376
+ ** New in Version 0.3.0 **
377
+
378
+
379
+ Encrypted Assertions require the xmlenc gem. See the example in the Controller
380
+
381
+ section of the README.
382
+
352
383
  '
353
384
  rdoc_options:
354
385
  - --charset=UTF-8
@@ -362,7 +393,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
362
393
  version: '0'
363
394
  segments:
364
395
  - 0
365
- hash: -213733986109454485
396
+ hash: 1850283737976678938
366
397
  required_rubygems_version: !ruby/object:Gem::Requirement
367
398
  none: false
368
399
  requirements:
@@ -371,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
371
402
  version: '0'
372
403
  segments:
373
404
  - 0
374
- hash: -213733986109454485
405
+ hash: 1850283737976678938
375
406
  requirements: []
376
407
  rubyforge_project:
377
408
  rubygems_version: 1.8.23
@@ -386,6 +417,9 @@ test_files:
386
417
  - spec/lib/saml_idp/attribute_decorator_spec.rb
387
418
  - spec/lib/saml_idp/configurator_spec.rb
388
419
  - spec/lib/saml_idp/controller_spec.rb
420
+ - spec/lib/saml_idp/encryptor_spec.rb
421
+ - spec/lib/saml_idp/logout_request_builder_spec.rb
422
+ - spec/lib/saml_idp/logout_response_builder_spec.rb
389
423
  - spec/lib/saml_idp/metadata_builder_spec.rb
390
424
  - spec/lib/saml_idp/name_id_formatter_spec.rb
391
425
  - spec/lib/saml_idp/request_spec.rb