libsaml 2.15.3 → 2.15.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2db62f5b3abb1ca37456aa12e69d363b23178cc
4
- data.tar.gz: c0b5292becca288420deed6034eafa16f51750fb
3
+ metadata.gz: 4ff45f250b6c9660592b1bd45e38be03353e3477
4
+ data.tar.gz: 007f63e6a19af60dbb06b8a32aeaec058f97436c
5
5
  SHA512:
6
- metadata.gz: 3c3754321105462f5f18780706d8c32ec63351ec6c793ef9d93df916768ff18809a036eab4abef1ea9b46df6a6c65c2184de40df68ff9ba801730a6ada0aa0f0
7
- data.tar.gz: 09a682a5833c2766bdb0887ff9151d561cb9e8cc3cf0fc7429f666987996adacd313b9f3679765a8c36d9ad647be4bcc50ad17235bd38f534091588674ca0220
6
+ metadata.gz: 92bb5e00d9f0072b5a32721c548ac788280ce96e3f150343fd6fd4d26213d0b1fc35eeb60cb8fb3544a48356317092ab4f6814e503cc3fe239c52e0aef7cde69
7
+ data.tar.gz: a4324d76708a171c044c9cc4b4303a19c14b3952a081a6f2d525f97739e0d9d8e1a15aa4ce91b35d1e6eea79c6d6ebba0be4c84f5c7b1070eb9bc32659947c58
@@ -3,6 +3,8 @@ module Saml
3
3
  include Saml::Base
4
4
  include Saml::XMLHelpers
5
5
 
6
+ attr_accessor :xml_value
7
+
6
8
  register_namespace 'samlp', Saml::SAMLP_NAMESPACE
7
9
  register_namespace 'saml', Saml::SAML_NAMESPACE
8
10
 
@@ -2,6 +2,8 @@ module Saml
2
2
  class AuthnRequest
3
3
  include Saml::ComplexTypes::RequestAbstractType
4
4
 
5
+ attr_accessor :xml_value
6
+
5
7
  tag 'AuthnRequest'
6
8
  attribute :force_authn, Boolean, :tag => "ForceAuthn"
7
9
  attribute :is_passive, Boolean, :tag => "IsPassive"
@@ -8,8 +8,6 @@ module Saml
8
8
  include ::XmlMapper
9
9
  include ::ActiveModel::Validations
10
10
 
11
- attr_accessor :xml_node
12
-
13
11
  def use_parsed
14
12
  @use_parsed = true
15
13
  self
@@ -35,6 +33,11 @@ module Saml
35
33
  def from_xml?
36
34
  @from_xml
37
35
  end
36
+
37
+ def use_original(object)
38
+ registered_namespaces.merge!(Saml::Util.collect_extra_namespaces(object.xml_value))
39
+ object.use_parsed
40
+ end
38
41
  end
39
42
 
40
43
  module XmlMapperClassMethods
@@ -2,6 +2,8 @@ module Saml
2
2
  class Response
3
3
  include Saml::ComplexTypes::StatusResponseType
4
4
 
5
+ attr_accessor :xml_value
6
+
5
7
  tag "Response"
6
8
  has_many :assertions, Saml::Assertion, xpath: './'
7
9
  has_many :encrypted_assertions, Saml::Elements::EncryptedAssertion
@@ -29,10 +29,10 @@ module Saml
29
29
  http.key = OpenSSL::PKey::RSA.new(key)
30
30
  end
31
31
 
32
- headers = {
33
- 'Content-Type' => 'text/xml',
34
- 'Cache-Control' => 'no-cache, no-store',
35
- 'Pragma' => 'no-cache'
32
+ headers = {
33
+ 'Content-Type' => 'text/xml',
34
+ 'Cache-Control' => 'no-cache, no-store',
35
+ 'Pragma' => 'no-cache'
36
36
  }
37
37
  headers.merge! additional_headers
38
38
 
@@ -57,14 +57,14 @@ module Saml
57
57
 
58
58
  def encrypt_assertion(assertion, key_descriptor_or_certificate)
59
59
  case key_descriptor_or_certificate
60
- when OpenSSL::X509::Certificate
61
- certificate = key_descriptor_or_certificate
62
- key_name = nil
63
- when Saml::Elements::KeyDescriptor
64
- certificate = key_descriptor_or_certificate.certificate
65
- key_name = key_descriptor_or_certificate.key_info.key_name
66
- else
67
- raise ArgumentError.new("Expecting Certificate or KeyDescriptor got: #{key_descriptor_or_certificate.class}")
60
+ when OpenSSL::X509::Certificate
61
+ certificate = key_descriptor_or_certificate
62
+ key_name = nil
63
+ when Saml::Elements::KeyDescriptor
64
+ certificate = key_descriptor_or_certificate.certificate
65
+ key_name = key_descriptor_or_certificate.key_info.key_name
66
+ else
67
+ raise ArgumentError.new("Expecting Certificate or KeyDescriptor got: #{key_descriptor_or_certificate.class}")
68
68
  end
69
69
 
70
70
  assertion = assertion.to_xml(nil, nil, false) if assertion.is_a?(Assertion) # create xml without instruct
@@ -100,7 +100,7 @@ module Saml
100
100
  end
101
101
 
102
102
  def decrypt_encrypted_id(encrypted_id, private_key)
103
- encrypted_id_xml = encrypted_id.is_a?(Saml::Elements::EncryptedID) ?
103
+ encrypted_id_xml = encrypted_id.is_a?(Saml::Elements::EncryptedID) ?
104
104
  encrypted_id.to_xml : encrypted_id.to_s
105
105
  encrypted_document = Xmlenc::EncryptedDocument.new(encrypted_id_xml)
106
106
  Saml::Elements::EncryptedID.parse(encrypted_document.decrypt(private_key))
@@ -120,6 +120,11 @@ module Saml
120
120
  message.class.parse(signed_node.to_xml, single: true)
121
121
  end
122
122
 
123
+ def collect_extra_namespaces(raw_xml)
124
+ doc = Nokogiri::XML(raw_xml, nil, nil, Nokogiri::XML::ParseOptions::STRICT)
125
+ doc.collect_namespaces.each_with_object({}) { |(prefix, path), hash| hash[prefix.gsub('xmlns:', '')] = path }
126
+ end
127
+
123
128
  def download_metadata_xml(location)
124
129
  uri = URI.parse(location)
125
130
 
@@ -1,3 +1,3 @@
1
1
  module Saml
2
- VERSION = "2.15.3"
2
+ VERSION = "2.15.4"
3
3
  end
@@ -17,8 +17,8 @@ module Saml
17
17
  write_xml = builder.nil? ? true : false
18
18
  builder ||= Nokogiri::XML::Builder.new
19
19
  builder.doc.encoding = "UTF-8"
20
- result = if xml_node && use_parsed?
21
- builder.send(:insert, xml_node)
20
+ result = if use_parsed? && respond_to?(:xml_value)
21
+ builder << xml_value
22
22
  builder
23
23
  else
24
24
  super(builder, default_namespace)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libsaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.3
4
+ version: 2.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoist Claassen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.2
47
+ version: 0.6.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.2
54
+ version: 0.6.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: xmldsig
57
57
  requirement: !ruby/object:Gem::Requirement