diff options
| author | mokha <mokha@cisco.com> | 2018-03-06 11:40:09 -0700 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-03-06 11:40:09 -0700 |
| commit | e9f06522693885f77925a3cdb1e7e2c60b6ee050 (patch) | |
| tree | 2a54b8dcf842d462bca43bd83e2f9cdbb0be31cd | |
| parent | 33a4f65edc9e1630fa78b1152f911e97e301a173 (diff) | |
extract build head and body methods.
| -rw-r--r-- | lib/saml/kit/cli/report.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/saml/kit/cli/report.rb b/lib/saml/kit/cli/report.rb index c39780b..3e38aff 100644 --- a/lib/saml/kit/cli/report.rb +++ b/lib/saml/kit/cli/report.rb @@ -11,14 +11,11 @@ module Saml def print(shell) shell.say_status :success, "Decoded #{document.send(:name)}" shell.print_table build_table_for(document) - shell.say '' - if document.signature.present? && - document.signature.certificate.present? - shell.say(document.signature.certificate.x509.to_text) + signature = document.signature + if signature.present? && signature.certificate.present? + shell.say(signature.certificate.x509.to_text) end - shell.say '' shell.say document.to_xml(pretty: true), :green - shell.say '' document.errors.full_messages.each do |error| shell.say_status :error, error, :red end @@ -30,7 +27,7 @@ module Saml text.length >= max ? "#{text[0..max]}..." : text end - def build_table_for(document) + def build_header_for(document) table = [] case document when Saml::Kit::Document @@ -77,6 +74,11 @@ module Saml ]) table.push(['', signature.certificate.x509.to_text]) end + table + end + + def build_body_for(document) + table = [] case document when Saml::Kit::AuthenticationRequest table.push(['ACS', document.assertion_consumer_service_url]) @@ -110,8 +112,12 @@ module Saml ]) table.push(['', signature.certificate.x509.to_text]) end + table end - table + end + + def build_table_for(document) + build_header_for(document) + build_body_for(document) end end end |
