Commit fb32b86

mo <mo@mokhan.ca>
2017-11-15 22:57:43
update controller to use builder directly.
1 parent 3572105
lib/saml/kit/authentication_request.rb
@@ -142,7 +142,7 @@ module Saml
       class Builder
         attr_accessor :id, :now, :issuer, :acs_url, :name_id_format, :sign, :destination
 
-        def initialize(user = nil, configuration: Saml::Kit.configuration, sign: true)
+        def initialize(configuration: Saml::Kit.configuration, sign: true)
           @id = SecureRandom.uuid
           @issuer = configuration.issuer
           @name_id_format = Namespaces::PERSISTENT
lib/saml/kit/invalid_request.rb
@@ -13,6 +13,10 @@ module Saml
         @raw = raw
         @name = "InvalidRequest"
       end
+
+      def to_xml
+        raw
+      end
     end
   end
 end
lib/saml/kit/signature.rb
@@ -53,7 +53,7 @@ module Saml
       def finalize(xml)
         if sign && reference_id.present?
           document = Xmldsig::SignedDocument.new(xml.target!)
-          document.sign(configuration.signing_private_key)
+          document.sign(private_key)
         else
           xml.target!
         end
@@ -64,6 +64,12 @@ module Saml
         yield xml, signature
         signature.finalize(xml)
       end
+
+      private
+
+      def private_key
+        configuration.signing_private_key
+      end
     end
   end
 end