Commit 41077d9

mo <mo.khan@gmail.com>
2017-12-15 23:23:34
allow passing config down.
1 parent 59218ca
Changed files (3)
lib/saml/kit/bindings/http_post.rb
@@ -18,9 +18,9 @@ module Saml
           [location, saml_params]
         end
 
-        def deserialize(params)
+        def deserialize(params, configuration: Saml::Kit.configuration)
           xml = decode(saml_param_from(params))
-          Saml::Kit::Document.to_saml_document(xml)
+          Saml::Kit::Document.to_saml_document(xml, configuration: configuration)
         end
       end
     end
lib/saml/kit/document.rb
@@ -64,16 +64,16 @@ module Saml
       end
 
       class << self
-        def to_saml_document(xml)
+        def to_saml_document(xml, configuration: Saml::Kit.configuration)
           hash = Hash.from_xml(xml)
           if hash['Response'].present?
-            Response.new(xml)
+            Response.new(xml, configuration: configuration)
           elsif hash['LogoutResponse'].present?
-            LogoutResponse.new(xml)
+            LogoutResponse.new(xml, configuration: configuration)
           elsif hash['AuthnRequest'].present?
-            AuthenticationRequest.new(xml)
+            AuthenticationRequest.new(xml, configuration: configuration)
           elsif hash['LogoutRequest'].present?
-            LogoutRequest.new(xml)
+            LogoutRequest.new(xml, configuration: configuration)
           end
         rescue => error
           Saml::Kit.logger.error(error)
lib/saml/kit/logout_response.rb
@@ -3,9 +3,9 @@ module Saml
     class LogoutResponse < Document
       include Respondable
 
-      def initialize(xml, request_id: nil)
+      def initialize(xml, request_id: nil, configuration: Saml::Kit.configuration)
         @request_id = request_id
-        super(xml, name: "LogoutResponse")
+        super(xml, name: "LogoutResponse", configuration: configuration)
       end
 
       Builder = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::LogoutResponse::Builder', 'Saml::Kit::Builders::LogoutResponse')