Commit a737a41

mo <mo.khan@gmail.com>
2017-12-17 20:22:05
trust a document that was verified manually.
1 parent c0c3bfb
Changed files (2)
lib
spec
lib/saml/kit/trustable.rb
@@ -6,11 +6,11 @@ module Saml
       included do
         validate :must_have_valid_signature, unless: :signature_manually_verified
         validate :must_be_registered
-        validate :must_be_trusted, unless: :signature_manually_verified
+        validate :must_be_trusted
       end
 
       def signed?
-        signature.present?
+        signature_manually_verified || signature.present?
       end
 
       def signature
@@ -19,6 +19,7 @@ module Saml
       end
 
       def trusted?
+        return true if signature_manually_verified
         return false unless signed?
         signature.trusted?(provider)
       end
spec/saml/bindings/http_redirect_spec.rb
@@ -87,9 +87,9 @@ RSpec.describe Saml::Kit::Bindings::HttpRedirect do
       expect(result).to be_instance_of(Saml::Kit::LogoutResponse)
     end
 
-    it 'raise an error when the content is invalid' do
+    it 'raises an error when the content is invalid' do
       expect do
-        subject.deserialize({ 'SAMLResponse' => "nonsense" })
+        subject.deserialize('SAMLResponse' => "nonsense")
       end.to raise_error(Zlib::DataError)
     end