Commit 53ce2a0
Changed files (3)
lib
saml
spec
saml
lib/saml/kit/signature.rb
@@ -12,9 +12,9 @@ module Saml
Saml::Kit::Certificate.new(value, use: :signing)
end
- def trusted?(provider)
- return false if provider.nil?
- provider.matches?(certificate.fingerprint, use: :signing)
+ def trusted?(metadata)
+ return false if metadata.nil?
+ metadata.matches?(certificate.fingerprint, use: :signing)
end
def to_h
lib/saml/kit/trustable.rb
@@ -9,11 +9,6 @@ module Saml
validate :must_be_trusted, unless: :signature_manually_verified
end
- def certificate
- return unless signed?
- signature.certificate
- end
-
def signed?
signature.present?
end
spec/saml/response_spec.rb
@@ -283,9 +283,9 @@ RSpec.describe Saml::Kit::Response do
</samlp:Response>
XML
subject = described_class.new(xml)
- expect(subject.certificate).to be_nil
- expect(subject.assertion.certificate).to be_instance_of(Saml::Kit::Certificate)
- expect(subject.assertion.certificate.stripped).to eql(certificate.stripped)
+ expect(subject.signature).to be_nil
+ expect(subject.assertion.signature).to be_present
+ expect(subject.assertion.signature.certificate.stripped).to eql(certificate.stripped)
end
it 'returns the certificate when the Response is signed' do
@@ -316,7 +316,7 @@ RSpec.describe Saml::Kit::Response do
</samlp:Response>
XML
subject = described_class.new(xml)
- expect(subject.certificate).to eql(certificate)
+ expect(subject.signature.certificate).to eql(certificate)
end
it 'returns nil when there is no signature' do
@@ -327,7 +327,7 @@ RSpec.describe Saml::Kit::Response do
</samlp:Response>
XML
subject = described_class.new(xml)
- expect(subject.certificate).to be_nil
+ expect(subject.signature).to be_nil
end
end