Commit 0bdf3a5

mo <mo@mokhan.ca>
2017-12-01 23:21:59
sign assertions if the SP requests it.
1 parent 38225d4
lib/saml/kit/authentication_request.rb
@@ -18,6 +18,7 @@ module Saml
       def response_for(user, binding:, relay_state: nil)
         response_binding = provider.assertion_consumer_service_for(binding: binding)
         builder = Saml::Kit::Response.builder(user, self) do |x|
+          x.sign = provider.want_assertions_signed
           yield x if block_given?
         end
         response_binding.serialize(builder, relay_state: relay_state)
lib/saml/kit/service_provider_metadata.rb
@@ -15,6 +15,7 @@ module Saml
 
       def want_assertions_signed
         attribute = document.find_by("/md:EntityDescriptor/md:#{name}").attribute("WantAssertionsSigned")
+        return true if attribute.nil?
         attribute.text.downcase == "true"
       end