libsaml 2.17.0 → 2.18.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: 6533e2ced1cadafa719484e26db20a90655567c6
4
- data.tar.gz: 6c6dc3ba78ea7c268945c992fad01084f3d9b2c5
3
+ metadata.gz: 73a0241659419df0fec12c8812aac9f42c7b82f9
4
+ data.tar.gz: 36dbc7b1e49ead6ec16029060b1025aadb2ee23d
5
5
  SHA512:
6
- metadata.gz: 0d3d0ceab9c2f3523162f8bf5e1347518a2b96d67e1b1f6d1e32f5b632a76804d06db64aefb6e0ccc1f28855b48bfc600933195f7e61e00dcaad9465e54c5fb8
7
- data.tar.gz: 547ad0e4f947f322f9b22554dad25ac729a5bcd0c94a009460a5ffffeaf104ad7c517ed50da13867a28cd25bad5ba6d4f7e8a59dd2965aaa5ce6a7ec7f59009e
6
+ metadata.gz: 93715c9835434ee25ba4df7da290041b142fa379e0a68a3e197e36974f36fb78aedacb75d52d81637623f0447b19dd8109d02be9c28ce2b2d0af8c4b716fe068
7
+ data.tar.gz: 5ef0339348b56368adb47c585a0d74b62cf641bc9fb170be7c4171aebae6e2cf4eed45e22c1acf8745af07915528de4a0c62e8ba26046461f906b6b0abb1baed
data/lib/saml.rb CHANGED
@@ -5,6 +5,7 @@ require 'saml/xml_helpers'
5
5
  require 'saml/encoding'
6
6
  require 'saml/util'
7
7
  require 'saml/notification'
8
+ require 'saml/attribute_fetcher'
8
9
  require 'xmlenc'
9
10
  require 'xmldsig'
10
11
  require "net/https"
@@ -112,6 +113,7 @@ module Saml
112
113
  require 'saml/elements/authenticating_authority'
113
114
  require 'saml/elements/subject_locality'
114
115
  require 'saml/elements/authn_context'
116
+ require 'saml/elements/audience'
115
117
  require 'saml/elements/audience_restriction'
116
118
  require 'saml/elements/sub_status_code'
117
119
  require 'saml/elements/status_code'
@@ -55,8 +55,8 @@ module Saml
55
55
 
56
56
  def add_attribute(key, value)
57
57
  self.attribute_statement ||= Saml::Elements::AttributeStatement.new
58
- self.attribute_statement.attribute ||= []
59
- self.attribute_statement.attribute << Saml::Elements::Attribute.new(name: key, attribute_value: value)
58
+ self.attribute_statement.attributes ||= []
59
+ self.attribute_statement.attributes << Saml::Elements::Attribute.new(name: key, attribute_value: value)
60
60
  end
61
61
 
62
62
  def fetch_attribute(key)
@@ -65,7 +65,7 @@ module Saml
65
65
 
66
66
  def fetch_attributes(key)
67
67
  return unless self.attribute_statements
68
- return unless self.attribute_statements.flat_map(&:attribute)
68
+ return unless self.attribute_statements.flat_map(&:attributes)
69
69
  attribute_statements.flat_map { |attribute_statement| attribute_statement.fetch_attributes(key) }
70
70
  end
71
71
 
@@ -75,7 +75,7 @@ module Saml
75
75
 
76
76
  def fetch_attribute_values(key)
77
77
  return unless self.attribute_statements
78
- return unless self.attribute_statements.flat_map(&:attribute)
78
+ return unless self.attribute_statements.flat_map(&:attributes)
79
79
  attribute_statements.flat_map { |attribute_statement| attribute_statement.fetch_attribute_values(key) }
80
80
  end
81
81
 
@@ -0,0 +1,23 @@
1
+ module Saml
2
+ module AttributeFetcher
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ def fetch_attribute(key)
7
+ fetch_attribute_value(key).content
8
+ end
9
+
10
+ def fetch_attributes(key)
11
+ fetch_attribute_values(key).map(&:content)
12
+ end
13
+
14
+ def fetch_attribute_value(key)
15
+ fetch_attribute_values(key).first
16
+ end
17
+
18
+ def fetch_attribute_values(key)
19
+ attributes.find_all { |attr| attr.name == key }.flat_map(&:attribute_values)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -2,28 +2,23 @@ module Saml
2
2
  module Elements
3
3
  class AttributeStatement
4
4
  include Saml::Base
5
+ include Saml::AttributeFetcher
5
6
 
6
7
  tag 'AttributeStatement'
7
8
  register_namespace 'saml', Saml::SAML_NAMESPACE
8
9
  namespace 'saml'
9
10
 
10
- has_many :attribute, Saml::Elements::Attribute
11
+ has_many :attributes, Saml::Elements::Attribute
11
12
  has_many :encrypted_attributes, Saml::Elements::EncryptedAttribute
12
13
 
13
- def fetch_attribute(key)
14
- fetch_attribute_value(key).content
14
+ def attribute
15
+ warn '[DEPRECATED] please use #attributes'
16
+ attributes
15
17
  end
16
18
 
17
- def fetch_attributes(key)
18
- fetch_attribute_values(key).map(&:content)
19
- end
20
-
21
- def fetch_attribute_value(key)
22
- fetch_attribute_values(key).first
23
- end
24
-
25
- def fetch_attribute_values(key)
26
- attribute.find_all { |attr| attr.name == key }.flat_map(&:attribute_values)
19
+ def attribute=(attributes)
20
+ warn '[DEPRECATED] please use #attributes='
21
+ self.attributes = attributes
27
22
  end
28
23
  end
29
24
  end
@@ -0,0 +1,12 @@
1
+ module Saml
2
+ module Elements
3
+ class Audience
4
+ include Saml::Base
5
+
6
+ tag 'Audience'
7
+ namespace 'saml'
8
+
9
+ content :value, String
10
+ end
11
+ end
12
+ end
@@ -6,7 +6,7 @@ module Saml
6
6
  tag 'AudienceRestriction'
7
7
  namespace 'saml'
8
8
 
9
- has_many :audiences, String, tag: 'Audience'
9
+ has_many :audiences, Saml::Elements::Audience
10
10
 
11
11
  def audience
12
12
  Array(audiences).first
@@ -3,6 +3,7 @@ module Saml
3
3
  class SAMLPExtensions
4
4
  include Saml::Base
5
5
  include Saml::XMLHelpers
6
+ include Saml::AttributeFetcher
6
7
 
7
8
  tag "Extensions"
8
9
  namespace "samlp"
data/lib/saml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Saml
2
- VERSION = "2.17.0"
2
+ VERSION = "2.18.0"
3
3
  end
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.17.0
4
+ version: 2.18.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-12-03 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -127,6 +127,7 @@ files:
127
127
  - lib/saml/artifact_resolve.rb
128
128
  - lib/saml/artifact_response.rb
129
129
  - lib/saml/assertion.rb
130
+ - lib/saml/attribute_fetcher.rb
130
131
  - lib/saml/authn_request.rb
131
132
  - lib/saml/base.rb
132
133
  - lib/saml/basic_provider.rb
@@ -155,6 +156,7 @@ files:
155
156
  - lib/saml/elements/attribute_query.rb
156
157
  - lib/saml/elements/attribute_statement.rb
157
158
  - lib/saml/elements/attribute_value.rb
159
+ - lib/saml/elements/audience.rb
158
160
  - lib/saml/elements/audience_restriction.rb
159
161
  - lib/saml/elements/authenticating_authority.rb
160
162
  - lib/saml/elements/authn_context.rb