Commit f98f4de
Changed files (3)
lib
saml
exe/saml-kit-decode-http-redirect
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+require 'saml/kit'
+
+saml = STDIN.read
+binding = Saml::Kit::HttpRedirectBinding.new(location: '')
+xml = binding.deserialize('SAMLRequest' => saml).to_xml
+puts Nokogiri::XML(xml).to_xml(indent: 2)
lib/saml/kit/http_redirect_binding.rb
@@ -23,7 +23,8 @@ module Saml
private
def deserialize_document_from!(params)
- xml = inflate(decode(CGI.unescape(saml_param_from(params))))
+ xml = inflate(decode(unescape(saml_param_from(params))))
+ Saml::Kit.logger.debug(xml)
Saml::Kit::Document.to_saml_document(xml)
end
lib/saml/kit/serializable.rb
@@ -17,6 +17,10 @@ module Saml
def deflate(value, level: Zlib::BEST_COMPRESSION)
Zlib::Deflate.deflate(value, level)[2..-5]
end
+
+ def unescape(value)
+ CGI.unescape(value)
+ end
end
end
end