saml-kit-cli 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c985e11fb78e34f6262759b56a7c81bb3cbc0488a70edb29881bb5c446ab82f9
4
- data.tar.gz: 5adbce5aceeb439edddc75b478b8ccc4465f03bde6020cc920df563cbe084f75
3
+ metadata.gz: 59de9eccceb5455e9c5401acc901fff8bf7633510cf5516f92cbeecce0cd2677
4
+ data.tar.gz: c76817df6dbbf92c25c4e7af6d0d15d20797a6286d3c718eec4db0f06654235a
5
5
  SHA512:
6
- metadata.gz: e25a976d20ba8b9e464c1d5f95c706f061df8c8df4eef4a6a18f83dbebf2d680d9b0cdd432ac72709e6536c60aa06e12d599913659423b665e1f011ffaa67247
7
- data.tar.gz: 61d69d6f456e8ecf85423cb792cd462e35b5d0f0006c77cf2475e8a2300ae46ea091a9438ac02d65f2e0f0188f3c7b3e92f0f2d663ed18e210c5c4952720f86b
6
+ metadata.gz: 63d5998c035e2a4a81e3b58f41f01801f83904c3984f81ef73e786010eac4191955e5164ff1ee927f97865933646d6737d4bfdaec5e054a6b9d72aac765b0898
7
+ data.tar.gz: 430fc05192cfefaaa5ed58e8c5ce335dd14007b9049c77b595340a35bb9c5eb0885aac47a09639522cfb695d28b5c14b0ee2a477e5ac4ea2639b26bcf4f28293
@@ -16,6 +16,14 @@ module Saml
16
16
  say error.message, :red
17
17
  end
18
18
 
19
+ desc "raw <file>", "Decode the contents of a decoded file"
20
+ def raw(file)
21
+ content = IO.read(File.expand_path(file))
22
+ print_report_for(Document.to_saml_document(content))
23
+ rescue StandardError => error
24
+ say error.message, :red
25
+ end
26
+
19
27
  private
20
28
 
21
29
  def print_report_for(document)
@@ -16,7 +16,12 @@ module Saml
16
16
 
17
17
  desc "show entity_id", "show the metadata associated with an entityId"
18
18
  def show(entity_id)
19
- say registry.metadata_for(entity_id).to_xml(pretty: true), :green
19
+ metadata = registry.metadata_for(entity_id)
20
+ if metadata
21
+ Report.new(metadata).print(self)
22
+ else
23
+ say "`#{entity_id}` is not registered", :red
24
+ end
20
25
  end
21
26
 
22
27
  private
@@ -34,16 +34,48 @@ module Saml
34
34
  end
35
35
 
36
36
  def build_table_for(document)
37
- table = [
38
- ['ID', document.id],
39
- ['Issuer', document.issuer],
40
- ['Version', document.version],
41
- ['Issue Instant', document.issue_instant.iso8601],
42
- ['Type', document.send(:name)],
43
- ['Valid', document.valid?],
44
- ['Signed?', !!document.signed?],
45
- ['Trusted?', !!document.trusted?],
46
- ]
37
+ table = [ ]
38
+ case document
39
+ when Saml::Kit::Document
40
+ table.push(['ID', document.id])
41
+ table.push(['Issuer', document.issuer])
42
+ table.push(['Version', document.version])
43
+ table.push(['Issue Instant', document.issue_instant.iso8601])
44
+ table.push(['Type', document.send(:name)])
45
+ table.push(['Valid', document.valid?])
46
+ table.push(['Signed?', !!document.signed?])
47
+ table.push(['Trusted?', !!document.trusted?])
48
+ when Saml::Kit::Metadata
49
+ table.push(['Entity Id', document.entity_id])
50
+ table.push(['Type', document.send(:name)])
51
+ table.push(['Valid', document.valid?])
52
+ table.push(['Name Id Formats', document.name_id_formats.inspect])
53
+ table.push(['Organization', document.organization_name])
54
+ table.push(['Url', document.organization_url])
55
+ table.push(['Contact', document.contact_person_company])
56
+ [
57
+ 'SingleSignOnService',
58
+ 'SingleLogoutService',
59
+ 'AssertionConsumerService'
60
+ ].each do |type|
61
+ document.services(type).each do |service|
62
+ table.push([type, [service.location, service.binding]])
63
+ end
64
+ end
65
+ document.certificates.each do |certificate|
66
+ table.push(['', certificate.x509.to_text])
67
+ end
68
+ end
69
+ if document.signature.present?
70
+ signature = document.signature
71
+ table.push(['Digest Value', signature.digest_value])
72
+ table.push(['Expected Digest Value', signature.expected_digest_value])
73
+ table.push(['Digest Method', signature.digest_method])
74
+ table.push(['Signature Value', truncate(signature.signature_value)])
75
+ table.push(['Signature Method', signature.signature_method])
76
+ table.push(['Canonicalization Method', signature.canonicalization_method])
77
+ table.push(['', signature.certificate.x509.to_text])
78
+ end
47
79
  case document
48
80
  when Saml::Kit::AuthenticationRequest
49
81
  table.push(['ACS', document.assertion_consumer_service_url])
@@ -54,21 +86,23 @@ module Saml
54
86
  table.push(['Assertion Present?', document.assertion.present?])
55
87
  table.push(['Issuer', document.assertion.issuer])
56
88
  table.push(['Name Id', document.assertion.name_id])
57
- table.push(['Signed?', document.assertion.signed?])
89
+ table.push(['Signed?', !!document.assertion.signed?])
58
90
  table.push(['Attributes', document.assertion.attributes.inspect])
59
91
  table.push(['Not Before', document.assertion.started_at])
60
92
  table.push(['Not After', document.assertion.expired_at])
61
93
  table.push(['Audiences', document.assertion.audiences.inspect])
62
94
  table.push(['Encrypted?', document.assertion.encrypted?])
63
95
  table.push(['Decryptable', document.assertion.decryptable?])
64
- end
65
- if document.signature.present?
66
- table.push(['Digest Value', document.signature.digest_value])
67
- table.push(['Digest Method', document.signature.digest_method])
68
- table.push(['Signature Value', truncate(document.signature.signature_value)])
69
- table.push(['Signature Method', document.signature.signature_method])
70
- table.push(['Canonicalization Method', document.signature.canonicalization_method])
71
- table.push(['Certificate', document.signature.certificate.x509.to_text])
96
+ if document.assertion.present?
97
+ signature = document.assertion.signature
98
+ table.push(['Digest Value', signature.digest_value])
99
+ table.push(['Expected Digest Value', signature.expected_digest_value])
100
+ table.push(['Digest Method', signature.digest_method])
101
+ table.push(['Signature Value', truncate(signature.signature_value)])
102
+ table.push(['Signature Method', signature.signature_method])
103
+ table.push(['Canonicalization Method', signature.canonicalization_method])
104
+ table.push(['', signature.certificate.x509.to_text])
105
+ end
72
106
  end
73
107
  table
74
108
  end
@@ -1,7 +1,7 @@
1
1
  module Saml
2
2
  module Kit
3
3
  module Cli
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.6"
5
5
  end
6
6
  end
7
7
  end
data/saml-kit-cli.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
  spec.required_ruby_version = "~> 2.0"
24
24
 
25
- spec.add_dependency "saml-kit", "1.0.8"
25
+ spec.add_dependency "saml-kit", "1.0.9"
26
26
  spec.add_dependency "thor", "~> 0.20"
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saml-kit-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.8
19
+ version: 1.0.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.8
26
+ version: 1.0.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement