saml-kit-cli 0.2.0 → 0.3.0
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 +4 -4
- data/lib/saml/kit/cli.rb +5 -1
- data/lib/saml/kit/cli/version.rb +1 -1
- data/lib/saml/kit/cli/xml_digital_signature.rb +32 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ef88fa993a4960f8bad06af2fb7aecc46fb00748a6443bdad18f85cab2a0cb3
|
4
|
+
data.tar.gz: f9cf7c5c2ae3166c328fcadc8a7c58b4a41d6f39eb9c181043e8720e3050b342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 729fc3f950dddf6e778d21d8b028920e3cb99b642222cf777858e93616a8cdfdf6e454f9dff3fb29d7f655afdaa461558f3459d542e7e26c1c7e3b9d4be4a47c
|
7
|
+
data.tar.gz: c2e82c231509878a9b31976d3b80f9029b23a0867428c504f11a1f6f5d395bd20dbed2175230626932906a0b5bdf7df2be77e8e814d73f96fd39cf6ddd727d96
|
data/lib/saml/kit/cli.rb
CHANGED
@@ -2,10 +2,11 @@ require "saml/kit"
|
|
2
2
|
require "thor"
|
3
3
|
require "yaml/store"
|
4
4
|
|
5
|
-
require "saml/kit/cli/decode"
|
6
5
|
require "saml/kit/cli/certificate"
|
6
|
+
require "saml/kit/cli/decode"
|
7
7
|
require "saml/kit/cli/metadata"
|
8
8
|
require "saml/kit/cli/version"
|
9
|
+
require "saml/kit/cli/xml_digital_signature"
|
9
10
|
require "saml/kit/cli/yaml_registry"
|
10
11
|
|
11
12
|
module Saml
|
@@ -20,6 +21,9 @@ module Saml
|
|
20
21
|
|
21
22
|
desc "metadata SUBCOMMAND ...ARGS", "Work with SAML Metadata."
|
22
23
|
subcommand "metadata", Metadata
|
24
|
+
|
25
|
+
desc "xmldsig SUBCOMMAND ...ARGS", "Check XML digital signatures."
|
26
|
+
subcommand "xmldsig", XmlDigitalSignature
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
data/lib/saml/kit/cli/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Saml
|
2
|
+
module Kit
|
3
|
+
module Cli
|
4
|
+
class XmlDigitalSignature < Thor
|
5
|
+
desc "verify file", "Verify if the contents of a file has a valid signature."
|
6
|
+
method_option :format, default: "short", required: false, enum: ["short", "full"]
|
7
|
+
def verify(file)
|
8
|
+
format = options[:format]
|
9
|
+
path = File.expand_path(file)
|
10
|
+
say_status :status, "Attempting to read #{path}...", :yellow
|
11
|
+
content = IO.read(path)
|
12
|
+
document = ::Xml::Kit::Document.new(content)
|
13
|
+
|
14
|
+
if document.valid?
|
15
|
+
say_status :success, "#{file} is valid", :green
|
16
|
+
else
|
17
|
+
document.errors.full_messages.each do |error|
|
18
|
+
say_status :error, error, :red
|
19
|
+
end
|
20
|
+
|
21
|
+
if "full" == format
|
22
|
+
document.send(:invalid_signatures).each_with_index do |invalid_signature, index|
|
23
|
+
say "Signature: #{index}"
|
24
|
+
say invalid_signature.signature.to_xml(indent: 2), :red
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saml-kit-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: saml-kit
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/saml/kit/cli/decode.rb
|
104
104
|
- lib/saml/kit/cli/metadata.rb
|
105
105
|
- lib/saml/kit/cli/version.rb
|
106
|
+
- lib/saml/kit/cli/xml_digital_signature.rb
|
106
107
|
- lib/saml/kit/cli/yaml_registry.rb
|
107
108
|
- saml-kit-cli.gemspec
|
108
109
|
homepage: http://www.mokhan.ca/
|