Sha256: 424e976d9369907cfccf15d2780ec226303b36632405bbc0b2241934ee016fa4
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
# frozen_string_literal: true module Saml module Kit module Cli module Commands 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 say error.message, :red end desc( 'post saml', 'Decodes the SAMLRequest/SAMLResponse using the HTTP Post binding' ) method_option :export, default: nil, required: false def post(saml) print_report_for(post_binding.deserialize('SAMLRequest' => saml)) rescue StandardError => error say error.message, :red end desc 'raw <file>', 'Decode the contents of a decoded file' def raw(file) content = IO.read(File.expand_path(file)) print_report_for(Document.to_saml_document(content)) rescue StandardError => error say error.message, :red end private 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 def post_binding(location = '') Saml::Kit::Bindings::HttpPost.new(location: location) end def redirect_binding(location = '') Saml::Kit::Bindings::HttpRedirect.new(location: location) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
saml-kit-cli-0.3.8 | lib/saml/kit/cli/commands/decode.rb |
saml-kit-cli-0.3.7 | lib/saml/kit/cli/commands/decode.rb |