samlsso 0.1.5 → 0.1.6

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: 2c479c3d00dab26b27abac39e977a53d0f00d94f
4
- data.tar.gz: c7a702cbac650ccda58721c97d5ab74731b8bf49
3
+ metadata.gz: f77cfd3855990131639ddbb2c93737cfe8e5884d
4
+ data.tar.gz: a88195b337a64de1b2e237d92de9a8c82c3d4557
5
5
  SHA512:
6
- metadata.gz: 0be017698f649229731f2787dfedfcfb0e8f0935096ffddf998d7920e51871158882acde73dcac1b4a575a3b3b61e06da6bd70fa42221fe4e0290048244bd328
7
- data.tar.gz: 1b3308dac45366ede2aacafaea28ebc19ec17bd9c7ca0e1cecc9a2d3e958b73e5902669db5351383be6abae3bcbe6e8fe05e83affe48d30be0f2fc37169c11a7
6
+ metadata.gz: ea9a273fc674702a632a66b761deb62793f046addc303c7d767fe829781502164380917c29d44df39bf7ac9f0035e6333cb121e67e7554d77fc1d47af5c3b8fa
7
+ data.tar.gz: d83e3a13e682e1c241805af627d6fe341cc02eaf8a3f4392d78d4346ff54ae3425887fe8ab07e82ee68b70589e2650c33ad24b27353ce51c54d9b4ff969f8b86
@@ -1,3 +1,3 @@
1
1
  module Samlsso
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/xml_security.rb CHANGED
@@ -217,26 +217,47 @@ module XMLSecurity
217
217
  noko_sig_element.remove
218
218
 
219
219
  # check digests
220
- tmp = REXML::XPath.each(@sig_element, "//ds:Reference", {"ds"=>DSIG})
221
- tmp = REXML::XPath.each(@sig_element, "//ds:Reference") unless tmp.count > 0
222
- tmp do |ref|
223
- uri = ref.attributes.get_attribute("URI").value
220
+ if REXML::XPath.first(@sig_element, "//ds:Reference", {"ds"=>DSIG})
221
+ REXML::XPath.each(@sig_element, "//ds:Reference", {"ds"=>DSIG}) do |ref|
222
+ uri = ref.attributes.get_attribute("URI").value
224
223
 
225
- hashed_element = document.at_xpath("//*[@ID='#{uri[1..-1]}']")
226
- canon_algorithm = canon_algorithm REXML::XPath.first(ref, '//ds:CanonicalizationMethod', 'ds' => DSIG)
227
- canon_hashed_element = hashed_element.canonicalize(canon_algorithm, inclusive_namespaces)
224
+ hashed_element = document.at_xpath("//*[@ID='#{uri[1..-1]}']")
225
+ canon_algorithm = canon_algorithm REXML::XPath.first(ref, '//ds:CanonicalizationMethod', 'ds' => DSIG)
226
+ canon_hashed_element = hashed_element.canonicalize(canon_algorithm, inclusive_namespaces)
228
227
 
229
- digest_algorithm = algorithm(REXML::XPath.first(ref, "//ds:DigestMethod", 'ds' => DSIG))
228
+ digest_algorithm = algorithm(REXML::XPath.first(ref, "//ds:DigestMethod", 'ds' => DSIG))
230
229
 
231
- hash = digest_algorithm.digest(canon_hashed_element)
230
+ hash = digest_algorithm.digest(canon_hashed_element)
232
231
 
233
- base64_digest = REXML::XPath.first(ref, "//ds:DigestValue", {"ds"=>DSIG})
234
- base64_digest = REXML::XPath.first(ref, "//ds:DigestValue") unless base64_digest
235
- digest_value = Base64.decode64(base64_digest.text)
232
+ base64_digest = REXML::XPath.first(ref, "//ds:DigestValue", {"ds"=>DSIG})
233
+ base64_digest = REXML::XPath.first(ref, "//ds:DigestValue") unless base64_digest
234
+ digest_value = Base64.decode64(base64_digest.text)
236
235
 
237
- unless digests_match?(hash, digest_value)
238
- @errors << "Digest mismatch"
239
- return soft ? false : (raise Samlsso::ValidationError.new("Digest mismatch"))
236
+ unless digests_match?(hash, digest_value)
237
+ @errors << "Digest mismatch"
238
+ return soft ? false : (raise Samlsso::ValidationError.new("Digest mismatch"))
239
+ end
240
+ end
241
+ else
242
+ REXML::XPath.each(@sig_element, "//ds:Reference") do |ref|
243
+ uri = ref.attributes.get_attribute("URI").value
244
+
245
+ hashed_element = document.at_xpath("//*[@ID='#{uri[1..-1]}']")
246
+ canon_algorithm = canon_algorithm REXML::XPath.first(ref, '//ds:CanonicalizationMethod', 'ds' => DSIG)
247
+ canon_hashed_element = hashed_element.canonicalize(canon_algorithm, inclusive_namespaces)
248
+
249
+ digest_algorithm = algorithm(REXML::XPath.first(ref, "//ds:DigestMethod", 'ds' => DSIG))
250
+
251
+ hash = digest_algorithm.digest(canon_hashed_element)
252
+
253
+ base64_digest = REXML::XPath.first(ref, "//ds:DigestValue", {"ds"=>DSIG})
254
+ base64_digest = REXML::XPath.first(ref, "//ds:DigestValue") unless base64_digest
255
+ digest_value = Base64.decode64(base64_digest.text)
256
+
257
+ unless digests_match?(hash, digest_value)
258
+ @errors << "Digest mismatch"
259
+ return soft ? false : (raise Samlsso::ValidationError.new("Digest mismatch"))
260
+ end
240
261
  end
241
262
  end
242
263
 
data/samlsso-0.1.5.gem ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samlsso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siddhartha Mukherjee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uuid
@@ -140,6 +140,7 @@ files:
140
140
  - lib/schemas/xmldsig-core-schema.xsd
141
141
  - lib/xml_security.rb
142
142
  - samlsso-0.1.4.gem
143
+ - samlsso-0.1.5.gem
143
144
  - samlsso.gemspec
144
145
  homepage: https://github.com/siddhartham/samlsso
145
146
  licenses: