saml-kit 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cibuild +2 -3
- data/lib/saml/kit/signature.rb +14 -4
- data/lib/saml/kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d58bbb3c3a82d505f9898c871e9038d22cbf0fe6b50c59615e3a528e3770a0
|
4
|
+
data.tar.gz: 527f1c7a86aafa31d7bb5629325c177dfaeb3517c4c2d570832298c33622c647
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315cb5a0c5f725577fdae560a924d27cf421299af013bdc10a69a8842add199723088165b266f68dec8fa6af47fbc3b26d8c1f72fde4da5b857e627ae6618696
|
7
|
+
data.tar.gz: 05b34c3e338867fc0ebd8fe22bcddd41b41ccbf0629deb2813a2f63081cf0e05def3aaf48e9a6caa7474f754bbdffe6a224b90697a8ba7a6f9549176059d4d78
|
data/bin/cibuild
CHANGED
@@ -17,7 +17,6 @@ export RUBY_HEAP_FREE_MIN=100000
|
|
17
17
|
export RUBY_HEAP_SLOTS_INCREMENT=400000
|
18
18
|
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
19
19
|
|
20
|
-
gem install bundler --no-ri --no-rdoc --conservative
|
21
|
-
# run tests
|
22
20
|
ruby -v
|
23
|
-
|
21
|
+
gem install bundler --no-ri --no-rdoc --conservative
|
22
|
+
time bin/test
|
data/lib/saml/kit/signature.rb
CHANGED
@@ -31,6 +31,13 @@ module Saml
|
|
31
31
|
at_xpath('./ds:SignedInfo/ds:Reference/ds:DigestValue').try(:text)
|
32
32
|
end
|
33
33
|
|
34
|
+
def expected_digest_value
|
35
|
+
digests = dsignature.references.map do |x|
|
36
|
+
Base64.encode64(x.calculate_digest_value).chomp
|
37
|
+
end
|
38
|
+
digests.count > 1 ? digests : digests[0]
|
39
|
+
end
|
40
|
+
|
34
41
|
def digest_method
|
35
42
|
at_xpath('./ds:SignedInfo/ds:Reference/ds:DigestMethod/@Algorithm').try(:value)
|
36
43
|
end
|
@@ -69,11 +76,10 @@ module Saml
|
|
69
76
|
attr_reader :node
|
70
77
|
|
71
78
|
def validate_signature
|
72
|
-
return errors
|
79
|
+
return errors.add(:base, error_message(:empty)) if certificate.nil?
|
80
|
+
return if dsignature.valid?(certificate.x509)
|
73
81
|
|
74
|
-
|
75
|
-
return if signature.valid?(certificate.x509)
|
76
|
-
signature.errors.each do |attribute|
|
82
|
+
dsignature.errors.each do |attribute|
|
77
83
|
errors.add(attribute, error_message(attribute))
|
78
84
|
end
|
79
85
|
end
|
@@ -94,6 +100,10 @@ module Saml
|
|
94
100
|
return nil unless node
|
95
101
|
node.at_xpath(xpath, Saml::Kit::Document::NAMESPACES)
|
96
102
|
end
|
103
|
+
|
104
|
+
def dsignature
|
105
|
+
@dsignature ||= Xmldsig::Signature.new(node, 'ID=$uri or @Id')
|
106
|
+
end
|
97
107
|
end
|
98
108
|
end
|
99
109
|
end
|
data/lib/saml/kit/version.rb
CHANGED