Commit 0987b74
2017-11-19 20:13:19
1 parent
03079ff
Changed files (3)
saml-kit
lib
saml
saml-kit/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)
saml-kit/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
saml-kit/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