libsaml 2.7.0 → 2.8.0

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: 15b1bc506c0d773071297dcf07db5790ae88f380
4
- data.tar.gz: ec73cff60998ef1fbb56ff21997cd28765dfd818
3
+ metadata.gz: a9e195ed198652f536ab402c05ff6482b5a8a01e
4
+ data.tar.gz: 250c776273dc68c698543239a95ed47cb77522a9
5
5
  SHA512:
6
- metadata.gz: 5774652f6ed9ad934b8bc619ec691cfe1bd90c423723f785ad5e5697a12973ef2ce182a76bd0f8973858efc20a42c4cc1eee77d0ff47a0dca9a40d314057d576
7
- data.tar.gz: cc807e052949b5d7319e504329644e330fea0d9a32898a9333b8379c597914e521995b4e46d99fa0ffc9e713264be4d6bea9b35ac49cf376d510a5f11692af39
6
+ metadata.gz: 32ce58306d95b976fc0477ebdfd16c91bf9a1aea336db82e7a4cd0451b53f9c2778bb69875503c581845ba4bcc513b4e91e4f8e64a555729d823299aa03ea26c
7
+ data.tar.gz: 0e26262b7cc6542270b51895deaf037dcb21783c589aad812ca137d9ff703e65ffd741581368aa80700789a8479765f5875f6c4340d603d684f8bb0076a6102c
data/lib/saml.rb CHANGED
@@ -16,6 +16,8 @@ module Saml
16
16
  MD_ATTR_NAMESPACE = 'urn:oasis:names:tc:SAML:metadata:attribute'
17
17
  SAML_NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
18
18
  SAMLP_NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:protocol'
19
+ XS_NAMESPACE = 'http://www.w3.org/2001/XMLSchema'
20
+ XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
19
21
  XML_DSIG_NAMESPACE = 'http://www.w3.org/2000/09/xmldsig#'
20
22
  SAML_VERSION = '2.0'
21
23
 
@@ -111,6 +113,7 @@ module Saml
111
113
  require 'saml/elements/subject_confirmation'
112
114
  require 'saml/elements/encrypted_assertion'
113
115
  require 'saml/elements/encrypted_attribute'
116
+ require 'saml/elements/attribute_value'
114
117
  require 'saml/elements/attribute'
115
118
  require 'saml/elements/attribute_statement'
116
119
  require 'saml/elements/entity_attributes'
@@ -10,15 +10,31 @@ module Saml
10
10
  attribute :name, String, :tag => 'Name'
11
11
  attribute :format, String, tag: 'NameFormat'
12
12
  attribute :friendly_name, String, tag: 'FriendlyName'
13
- element :attribute_value, String, :namespace => 'saml', :tag => "AttributeValue"
13
+
14
+ has_many :attribute_values, Saml::Elements::AttributeValue
14
15
 
15
16
  validates :name, :presence => true
16
17
  end
17
18
 
18
19
  def initialize(*args)
19
20
  options = args.extract_options!
21
+ @attribute_values ||= []
20
22
  super(*(args << options))
21
23
  end
24
+
25
+ def attribute_value
26
+ warn '[DEPRECATED] please use #attribute_values'
27
+ attribute_values.first.try(:content)
28
+ end
29
+
30
+ def attribute_value=(value)
31
+ self.attribute_values << if value.is_a? String
32
+ Saml::Elements::AttributeValue.new(content: value)
33
+ else
34
+ value
35
+ end
36
+ end
37
+
22
38
  end
23
39
  end
24
40
  end
@@ -3,7 +3,7 @@ module Saml
3
3
  class StatementAbstractType
4
4
  include HappyMapper
5
5
 
6
- register_namespace 'xsi', 'http://www.w3.org/2001/XMLSchema-instance'
6
+ register_namespace 'xsi', Saml::XSI_NAMESPACE
7
7
 
8
8
  tag 'Statement'
9
9
  namespace 'saml'
@@ -15,7 +15,7 @@ module Saml
15
15
  end
16
16
 
17
17
  def fetch_attributes(key)
18
- attribute.find_all { |attr| attr.name == key }.map(&:attribute_value)
18
+ attribute.find_all { |attr| attr.name == key }.flat_map(&:attribute_values).map(&:content)
19
19
  end
20
20
  end
21
21
  end
@@ -0,0 +1,18 @@
1
+ module Saml
2
+ module Elements
3
+ class AttributeValue
4
+ include Saml::Base
5
+
6
+ register_namespace 'saml', Saml::SAML_NAMESPACE
7
+ register_namespace 'xs', Saml::XS_NAMESPACE
8
+ register_namespace 'xsi', Saml::XSI_NAMESPACE
9
+
10
+ namespace 'saml'
11
+ tag 'AttributeValue'
12
+
13
+ attribute :type, String, tag: 'xsi:type'
14
+
15
+ content :content, String
16
+ end
17
+ end
18
+ end
data/lib/saml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saml
2
- VERSION = "2.7.0"
2
+ VERSION = "2.8.0"
3
3
  end
@@ -27,8 +27,8 @@ module Saml
27
27
 
28
28
  builder = Nokogiri::XML::Builder.new(:encoding => "UTF-8")
29
29
  builder.Envelope(:'xmlns:soapenv' => "http://schemas.xmlsoap.org/soap/envelope/",
30
- :'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema",
31
- :'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance") do |xml|
30
+ :'xmlns:xsd' => Saml::XS_NAMESPACE,
31
+ :'xmlns:xsi' => Saml::XSI_NAMESPACE) do |xml|
32
32
  builder.parent.namespace = builder.parent.namespace_definitions.find { |n| n.prefix == 'soapenv' }
33
33
  builder.Body do
34
34
  builder.parent.add_child body.doc.root
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.7.0
4
+ version: 2.8.0
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-10-12 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -147,6 +147,7 @@ files:
147
147
  - lib/saml/elements/attribute_authority_descriptor.rb
148
148
  - lib/saml/elements/attribute_consuming_service.rb
149
149
  - lib/saml/elements/attribute_statement.rb
150
+ - lib/saml/elements/attribute_value.rb
150
151
  - lib/saml/elements/audience_restriction.rb
151
152
  - lib/saml/elements/authenticating_authority.rb
152
153
  - lib/saml/elements/authn_context.rb