ruby-saml 1.7.1 → 1.7.2
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/changelog.md +3 -0
- data/lib/onelogin/ruby-saml/utils.rb +1 -1
- data/lib/onelogin/ruby-saml/version.rb +1 -1
- data/test/utils_test.rb +37 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58b2d78436fa5304bc67e40cd5f4a0cc766b4301
|
4
|
+
data.tar.gz: b2445dcda50eeb89ce6fe2b9b285c5021755e189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b90724f90916e973182de8bf2d009aeabfbc356acb167e927a63d1e360b831e540b25602ba4bb1d79b74fd6e07889860fda5f4620eeb31f76fdc9b585bd13f0
|
7
|
+
data.tar.gz: cd3750758fa6326bfe6be73552480b1f37994ba137eb048750afbd093d7ee4b23afadcbc1869bfdd49f9b77bdf29f629b0fc6963d814e3cdf54ad72281053999
|
data/changelog.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# RubySaml Changelog
|
2
2
|
|
3
|
+
### 1.7.2 (Feb 28, 2018)
|
4
|
+
* [#446](https://github.com/onelogin/ruby-saml/pull/446) Normalize text returned by OneLogin::RubySaml::Utils.element_text
|
5
|
+
|
3
6
|
### 1.7.1 (Feb 28, 2018)
|
4
7
|
* [#444](https://github.com/onelogin/ruby-saml/pull/444) Fix audience validation for empty audience restriction
|
5
8
|
|
@@ -286,7 +286,7 @@ module OneLogin
|
|
286
286
|
# that there all children other than text nodes can be ignored (e.g. comments). If nil is
|
287
287
|
# passed, nil will be returned.
|
288
288
|
def self.element_text(element)
|
289
|
-
element.texts.join if element
|
289
|
+
element.texts.map(&:value).join if element
|
290
290
|
end
|
291
291
|
end
|
292
292
|
end
|
data/test/utils_test.rb
CHANGED
@@ -213,5 +213,42 @@ class UtilsTest < Minitest::Test
|
|
213
213
|
assert !OneLogin::RubySaml::Utils.uri_match?(destination, settings)
|
214
214
|
end
|
215
215
|
end
|
216
|
+
|
217
|
+
describe 'element_text' do
|
218
|
+
it 'returns the element text' do
|
219
|
+
element = REXML::Document.new('<element>element text</element>').elements.first
|
220
|
+
assert_equal 'element text', OneLogin::RubySaml::Utils.element_text(element)
|
221
|
+
end
|
222
|
+
|
223
|
+
it 'returns all segments of the element text' do
|
224
|
+
element = REXML::Document.new('<element>element <!-- comment -->text</element>').elements.first
|
225
|
+
assert_equal 'element text', OneLogin::RubySaml::Utils.element_text(element)
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'returns normalized element text' do
|
229
|
+
element = REXML::Document.new('<element>element & text</element>').elements.first
|
230
|
+
assert_equal 'element & text', OneLogin::RubySaml::Utils.element_text(element)
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'returns the CDATA element text' do
|
234
|
+
element = REXML::Document.new('<element><![CDATA[element & text]]></element>').elements.first
|
235
|
+
assert_equal 'element & text', OneLogin::RubySaml::Utils.element_text(element)
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'returns the element text with newlines and additional whitespace' do
|
239
|
+
element = REXML::Document.new("<element> element \n text </element>").elements.first
|
240
|
+
assert_equal " element \n text ", OneLogin::RubySaml::Utils.element_text(element)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'returns nil when element is nil' do
|
244
|
+
assert_nil OneLogin::RubySaml::Utils.element_text(nil)
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'returns empty string when element has no text' do
|
248
|
+
element = REXML::Document.new('<element></element>').elements.first
|
249
|
+
assert_equal '', OneLogin::RubySaml::Utils.element_text(element)
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
216
253
|
end
|
217
254
|
end
|