saml-kit-cli 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/saml-kit +1 -0
- data/lib/saml/kit/cli.rb +1 -0
- data/lib/saml/kit/cli/decode.rb +17 -26
- data/lib/saml/kit/cli/report.rb +78 -0
- data/lib/saml/kit/cli/version.rb +1 -1
- data/saml-kit-cli.gemspec +1 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c985e11fb78e34f6262759b56a7c81bb3cbc0488a70edb29881bb5c446ab82f9
|
4
|
+
data.tar.gz: 5adbce5aceeb439edddc75b478b8ccc4465f03bde6020cc920df563cbe084f75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e25a976d20ba8b9e464c1d5f95c706f061df8c8df4eef4a6a18f83dbebf2d680d9b0cdd432ac72709e6536c60aa06e12d599913659423b665e1f011ffaa67247
|
7
|
+
data.tar.gz: 61d69d6f456e8ecf85423cb792cd462e35b5d0f0006c77cf2475e8a2300ae46ea091a9438ac02d65f2e0f0188f3c7b3e92f0f2d663ed18e210c5c4952720f86b
|
data/exe/saml-kit
CHANGED
@@ -4,6 +4,7 @@ require "saml/kit/cli"
|
|
4
4
|
|
5
5
|
samlkitrc = ENV.fetch("SAMLKITRC", File.join(Dir.home, ".samlkitrc"))
|
6
6
|
Saml::Kit.configure do |configuration|
|
7
|
+
configuration.entity_id = ENV.fetch('ENTITY_ID', `hostname`.chomp)
|
7
8
|
configuration.registry = Saml::Kit::Cli::YamlRegistry.new(samlkitrc)
|
8
9
|
configuration.logger.level = Logger::FATAL
|
9
10
|
end
|
data/lib/saml/kit/cli.rb
CHANGED
@@ -5,6 +5,7 @@ require "yaml/store"
|
|
5
5
|
require "saml/kit/cli/certificate"
|
6
6
|
require "saml/kit/cli/decode"
|
7
7
|
require "saml/kit/cli/metadata"
|
8
|
+
require "saml/kit/cli/report"
|
8
9
|
require "saml/kit/cli/version"
|
9
10
|
require "saml/kit/cli/xml_digital_signature"
|
10
11
|
require "saml/kit/cli/yaml_registry"
|
data/lib/saml/kit/cli/decode.rb
CHANGED
@@ -4,41 +4,32 @@ module Saml
|
|
4
4
|
class Decode < Thor
|
5
5
|
desc "redirect uri", "Decodes the uri using the HTTP Redirect binding"
|
6
6
|
def redirect(uri)
|
7
|
-
|
8
|
-
uri = URI.parse(uri)
|
9
|
-
query_params = Hash[uri.query.split('&').map { |x| x.split('=', 2) }]
|
10
|
-
document = binding.deserialize(query_params)
|
11
|
-
|
12
|
-
2.times { say "" }
|
13
|
-
say_status :success, "Decoded #{document.class}"
|
14
|
-
print_table [
|
15
|
-
["ID", "Issuer", "Version", "Issue instant"],
|
16
|
-
[document.id, document.issuer, document.version, document.issue_instant.iso8601 ]
|
17
|
-
]
|
18
|
-
say ""
|
19
|
-
say document.to_xml(pretty: true), :green
|
7
|
+
print_report_for(redirect_binding.deserialize(uri))
|
20
8
|
rescue StandardError => error
|
21
9
|
say error.message, :red
|
22
10
|
end
|
23
11
|
|
24
12
|
desc "post saml", "Decodes the SAMLRequest/SAMLResponse using the HTTP Post binding"
|
25
13
|
def post(saml_request)
|
26
|
-
|
27
|
-
document = binding.deserialize('SAMLRequest' => saml_request)
|
28
|
-
2.times { say "" }
|
29
|
-
say_status :success, "Decoded #{document.class}"
|
30
|
-
print_table [
|
31
|
-
["ID", "Issuer", "Version", "Issue instant", "Type", "Valid", "Signed", "Trusted"],
|
32
|
-
[document.id, document.issuer, document.version, document.issue_instant.iso8601, document.class, document.valid?, document.signed?, document.trusted? ]
|
33
|
-
]
|
34
|
-
document.errors.full_messages.each do |error|
|
35
|
-
say_status :error, error, :red
|
36
|
-
end
|
37
|
-
say ""
|
38
|
-
say document.to_xml(pretty: true), :green
|
14
|
+
print_report_for(post_binding.deserialize('SAMLRequest' => saml_request))
|
39
15
|
rescue StandardError => error
|
40
16
|
say error.message, :red
|
41
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def print_report_for(document)
|
22
|
+
2.times { say "" }
|
23
|
+
Report.new(document).print(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
def post_binding(location = '')
|
27
|
+
Saml::Kit::Bindings::HttpPost.new(location: location)
|
28
|
+
end
|
29
|
+
|
30
|
+
def redirect_binding(location = '')
|
31
|
+
Saml::Kit::Bindings::HttpRedirect.new(location: location)
|
32
|
+
end
|
42
33
|
end
|
43
34
|
end
|
44
35
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Saml
|
2
|
+
module Kit
|
3
|
+
module Cli
|
4
|
+
class Report
|
5
|
+
attr_reader :document
|
6
|
+
|
7
|
+
def initialize(document)
|
8
|
+
@document = document
|
9
|
+
end
|
10
|
+
|
11
|
+
def print(shell)
|
12
|
+
shell.say_status :success, "Decoded #{document.send(:name)}"
|
13
|
+
shell.print_table build_table_for(document)
|
14
|
+
shell.say ""
|
15
|
+
if document.signature.present? && document.signature.certificate.present?
|
16
|
+
shell.say(document.signature.certificate.x509.to_text)
|
17
|
+
end
|
18
|
+
shell.say ""
|
19
|
+
shell.say document.to_xml(pretty: true), :green
|
20
|
+
shell.say ""
|
21
|
+
document.errors.full_messages.each do |error|
|
22
|
+
shell.say_status :error, error, :red
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def truncate(text, max: 50)
|
29
|
+
if text.length >= max
|
30
|
+
"#{text[0..max]}..."
|
31
|
+
else
|
32
|
+
text
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
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
|
+
]
|
47
|
+
case document
|
48
|
+
when Saml::Kit::AuthenticationRequest
|
49
|
+
table.push(['ACS', document.assertion_consumer_service_url])
|
50
|
+
table.push(['Name Id Format', document.name_id_format])
|
51
|
+
when Saml::Kit::LogoutRequest
|
52
|
+
table.push(['Name Id', document.name_id])
|
53
|
+
when Saml::Kit::Response
|
54
|
+
table.push(['Assertion Present?', document.assertion.present?])
|
55
|
+
table.push(['Issuer', document.assertion.issuer])
|
56
|
+
table.push(['Name Id', document.assertion.name_id])
|
57
|
+
table.push(['Signed?', document.assertion.signed?])
|
58
|
+
table.push(['Attributes', document.assertion.attributes.inspect])
|
59
|
+
table.push(['Not Before', document.assertion.started_at])
|
60
|
+
table.push(['Not After', document.assertion.expired_at])
|
61
|
+
table.push(['Audiences', document.assertion.audiences.inspect])
|
62
|
+
table.push(['Encrypted?', document.assertion.encrypted?])
|
63
|
+
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])
|
72
|
+
end
|
73
|
+
table
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/lib/saml/kit/cli/version.rb
CHANGED
data/saml-kit-cli.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "saml/kit/cli/version"
|
@@ -23,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
23
22
|
spec.require_paths = ["lib"]
|
24
23
|
spec.required_ruby_version = "~> 2.0"
|
25
24
|
|
26
|
-
spec.add_dependency "saml-kit", "
|
25
|
+
spec.add_dependency "saml-kit", "1.0.8"
|
27
26
|
spec.add_dependency "thor", "~> 0.20"
|
28
27
|
spec.add_development_dependency "bundler", "~> 1.16"
|
29
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saml-kit-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: saml-kit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.8
|
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:
|
26
|
+
version: 1.0.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/saml/kit/cli/certificate.rb
|
103
103
|
- lib/saml/kit/cli/decode.rb
|
104
104
|
- lib/saml/kit/cli/metadata.rb
|
105
|
+
- lib/saml/kit/cli/report.rb
|
105
106
|
- lib/saml/kit/cli/version.rb
|
106
107
|
- lib/saml/kit/cli/xml_digital_signature.rb
|
107
108
|
- lib/saml/kit/cli/yaml_registry.rb
|