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 +4 -4
- data/lib/saml.rb +2 -0
- data/lib/saml/assertion.rb +4 -4
- data/lib/saml/attribute_fetcher.rb +23 -0
- data/lib/saml/elements/attribute_statement.rb +8 -13
- data/lib/saml/elements/audience.rb +12 -0
- data/lib/saml/elements/audience_restriction.rb +1 -1
- data/lib/saml/elements/samlp_extensions.rb +1 -0
- data/lib/saml/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a0241659419df0fec12c8812aac9f42c7b82f9
|
4
|
+
data.tar.gz: 36dbc7b1e49ead6ec16029060b1025aadb2ee23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'
|
data/lib/saml/assertion.rb
CHANGED
@@ -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.
|
59
|
-
self.attribute_statement.
|
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(&:
|
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(&:
|
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 :
|
11
|
+
has_many :attributes, Saml::Elements::Attribute
|
11
12
|
has_many :encrypted_attributes, Saml::Elements::EncryptedAttribute
|
12
13
|
|
13
|
-
def
|
14
|
-
|
14
|
+
def attribute
|
15
|
+
warn '[DEPRECATED] please use #attributes'
|
16
|
+
attributes
|
15
17
|
end
|
16
18
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
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
|
data/lib/saml/version.rb
CHANGED
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.
|
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-
|
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
|