Commit dc311b3

mo <mo@mokhan.ca>
2017-11-15 21:37:03
allow private key override.
1 parent 9b91421
Changed files (1)
lib
lib/saml/kit/url_builder.rb
@@ -1,6 +1,10 @@
 module Saml
   module Kit
     class UrlBuilder
+      def initialize(private_key: Saml::Kit.configuration.signing_private_key)
+        @private_key = private_key
+      end
+
       def build(saml_document, binding:, relay_state: nil)
         payload = {
           saml_document.query_string_parameter => Content.encode_raw_saml(saml_document.to_xml),
@@ -15,9 +19,7 @@ module Saml
 
       private
 
-      def private_key
-        Saml::Kit.configuration.signing_private_key
-      end
+      attr_reader :private_key
 
       def signature_for(payload)
         Base64.strict_encode64(private_key.sign(OpenSSL::Digest::SHA256.new, payload))