diff options
| author | mokha <mokha@cisco.com> | 2018-02-26 14:44:17 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-02-26 14:44:17 -0700 |
| commit | 049c1ef0c16ab486d2fb573fac41cedd67c8306d (patch) | |
| tree | 3a51eaba85d952ad780aa3fe3662a473eee4e511 /lib | |
| parent | 4ded943932a55f97b7c8d4df427a4cb9b1eac950 (diff) | |
add export to file option.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/saml/kit/cli/decode.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/saml/kit/cli/decode.rb b/lib/saml/kit/cli/decode.rb index 9892a75..dcb7e09 100644 --- a/lib/saml/kit/cli/decode.rb +++ b/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 |
