ruby-saml 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-saml might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/onelogin/ruby-saml/attributes.rb +23 -4
- data/lib/onelogin/ruby-saml/version.rb +1 -1
- data/test/response_test.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99b6868dbb0c85f62887107838735de63e1d9136
|
4
|
+
data.tar.gz: 15eeebe4a761be9840b5136dfe957fb966f9519d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a67ff93d0195daf43d1d4ecefea284be38566f85717314d2ec301d7fda271f14a1cbc60527d172fdc8314175f4ed67e30304ae9a2f840fa99988928c372745
|
7
|
+
data.tar.gz: e528f8945eea81bdbeedd9c2bf7bd9f66e466ca941852758b79d2ad84e05a59516057a9a173538de29336863f935bb649ca5083049e707f6f0bcb6a0b269ce3c
|
data/README.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Ruby SAML [![Build Status](https://secure.travis-ci.org/onelogin/ruby-saml.png)](http://travis-ci.org/onelogin/ruby-saml)
|
2
2
|
|
3
|
+
## Note on versions 0.8.6 and 0.8.7
|
4
|
+
Version `0.8.6` introduced an incompatibility with regards to manipulating the `OneLogin::RubySaml::Response#attributes` property; in this version
|
5
|
+
the `#attributes` property is a class (`OneLogin::RubySaml::Attributes`) which implements the `Enumerator` module, thus any non-overriden Hash method
|
6
|
+
will throw a NoMethodError.
|
7
|
+
Version `0.8.7` overrides the behavior of class `OneLogin::RubySaml::Attributes` by making any method not found on the class be tested on the
|
8
|
+
internal hash structure, thus all methods available in the `Hash` class are now available in `OneLogin::RubySaml::Response#attributes`.
|
9
|
+
|
3
10
|
## Updating from 0.7.x to 0.8.x
|
4
11
|
Version `0.8.x` changes the namespace of the gem from `OneLogin::Saml` to `OneLogin::RubySaml`. Please update your implementations of the gem accordingly.
|
5
12
|
|
@@ -48,7 +48,7 @@ module OneLogin
|
|
48
48
|
# @param name [String] The attribute name to be checked
|
49
49
|
#
|
50
50
|
def include?(name)
|
51
|
-
attributes.has_key?(canonize_name(name))
|
51
|
+
attributes.has_key?(canonize_name(name)) || attributes.has_key?(name)
|
52
52
|
end
|
53
53
|
|
54
54
|
# Return first value for an attribute
|
@@ -56,7 +56,7 @@ module OneLogin
|
|
56
56
|
# @return [String] The value (First occurrence)
|
57
57
|
#
|
58
58
|
def single(name)
|
59
|
-
|
59
|
+
multi(name).first if include?(name)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Return all values for an attribute
|
@@ -64,7 +64,15 @@ module OneLogin
|
|
64
64
|
# @return [Array] Values of the attribute
|
65
65
|
#
|
66
66
|
def multi(name)
|
67
|
-
attributes[canonize_name(name)]
|
67
|
+
values = attributes[canonize_name(name)] || attributes[name]
|
68
|
+
|
69
|
+
if values.is_a?(Array)
|
70
|
+
values
|
71
|
+
elsif !values.nil?
|
72
|
+
Array(values)
|
73
|
+
else
|
74
|
+
nil
|
75
|
+
end
|
68
76
|
end
|
69
77
|
|
70
78
|
# Retrieve attribute value(s)
|
@@ -76,7 +84,7 @@ module OneLogin
|
|
76
84
|
# response.attributes['mail'] # => ['user@example.com','user@example.net']
|
77
85
|
#
|
78
86
|
def [](name)
|
79
|
-
self.class.single_value_compatibility ? single(
|
87
|
+
self.class.single_value_compatibility ? single(name) : multi(name)
|
80
88
|
end
|
81
89
|
|
82
90
|
# @return [Array] Return all attributes as an array
|
@@ -113,6 +121,10 @@ module OneLogin
|
|
113
121
|
end
|
114
122
|
end
|
115
123
|
|
124
|
+
def respond_to?(name)
|
125
|
+
attributes.respond_to?(name) || super
|
126
|
+
end
|
127
|
+
|
116
128
|
protected
|
117
129
|
|
118
130
|
# stringifies all names so both 'email' and :email return the same result
|
@@ -123,6 +135,13 @@ module OneLogin
|
|
123
135
|
name.to_s
|
124
136
|
end
|
125
137
|
|
138
|
+
def method_missing(name, *args, &block)
|
139
|
+
if attributes.respond_to?(name)
|
140
|
+
attributes.send(name, *args, &block)
|
141
|
+
else
|
142
|
+
super
|
143
|
+
end
|
144
|
+
end
|
126
145
|
end
|
127
146
|
end
|
128
147
|
end
|
data/test/response_test.rb
CHANGED
@@ -236,6 +236,28 @@ class RubySamlTest < Test::Unit::TestCase
|
|
236
236
|
assert_equal "smith", response_with_multiple_attribute_statements.attributes[:surname]
|
237
237
|
assert_equal "bob", response_with_multiple_attribute_statements.attributes[:firstname]
|
238
238
|
end
|
239
|
+
|
240
|
+
should "be manipulable by hash methods such as #merge and not raise an exception" do
|
241
|
+
response = OneLogin::RubySaml::Response.new(response_document)
|
242
|
+
response.attributes.merge({ :testing_attribute => "test" })
|
243
|
+
end
|
244
|
+
|
245
|
+
should "be manipulable by hash methods such as #shift and not raise an exception" do
|
246
|
+
response = OneLogin::RubySaml::Response.new(response_document)
|
247
|
+
response.attributes.shift
|
248
|
+
end
|
249
|
+
|
250
|
+
should "be manipulable by hash methods such as #merge! and actually contain the value" do
|
251
|
+
response = OneLogin::RubySaml::Response.new(response_document)
|
252
|
+
response.attributes.merge!({ :testing_attribute => "test" })
|
253
|
+
assert response.attributes[:testing_attribute]
|
254
|
+
end
|
255
|
+
|
256
|
+
should "be manipulable by hash methods such as #shift and actually remove the value" do
|
257
|
+
response = OneLogin::RubySaml::Response.new(response_document)
|
258
|
+
removed_value = response.attributes.shift
|
259
|
+
assert_nil response.attributes[removed_value[0]]
|
260
|
+
end
|
239
261
|
end
|
240
262
|
|
241
263
|
context "#session_expires_at" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-saml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OneLogin LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuid
|