Commit ea3d4f3

mo <mo@mokhan.ca>
2017-11-20 23:48:55
add spec for valid authnrequest without signature.
1 parent 0d95185
Changed files (1)
spec/saml/authentication_request_spec.rb
@@ -148,6 +148,20 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
       end
       expect(described_class.new(signature.finalize(xml))).to be_invalid
     end
+
+    it 'validates a request without a signature' do
+      now = Time.now.utc
+raw_xml = <<-XML
+<samlp:AuthnRequest AssertionConsumerServiceURL='#{acs_url}' ID='_#{SecureRandom.uuid}' IssueInstant='#{now.iso8601}' Version='2.0' xmlns:saml='#{Saml::Kit::Namespaces::ASSERTION}' xmlns:samlp='#{Saml::Kit::Namespaces::PROTOCOL}'>
+  <saml:Issuer>#{issuer}</saml:Issuer>
+  <samlp:NameIDPolicy AllowCreate='true' Format='#{Saml::Kit::Namespaces::EMAIL_ADDRESS}'/>
+</samlp:AuthnRequest>
+XML
+
+      subject = described_class.new(raw_xml)
+      subject.signature_verified!
+      expect(subject).to be_valid
+    end
   end
 
   describe "#acs_url" do