Commit 049c1ef
Changed files (1)
lib
saml
kit
cli
lib/saml/kit/cli/decode.rb
@@ -3,6 +3,7 @@ module Saml
module Cli
class Decode < Thor
desc "redirect uri", "Decodes the uri using the HTTP Redirect binding"
+ method_option :export, default: nil, required: false
def redirect(uri)
print_report_for(redirect_binding.deserialize(uri))
rescue StandardError => error
@@ -10,6 +11,7 @@ module Saml
end
desc "post saml", "Decodes the SAMLRequest/SAMLResponse using the HTTP Post binding"
+ method_option :export, default: nil, required: false
def post(saml_request)
print_report_for(post_binding.deserialize('SAMLRequest' => saml_request))
rescue StandardError => error
@@ -26,7 +28,8 @@ module Saml
private
- def print_report_for(document)
+ def print_report_for(document, export = options[:export])
+ IO.write(export, document.to_xml) if export
2.times { say "" }
Report.new(document).print(self)
end