blob: 9fcea2c6e724611ea28b57e9f6612e91cb447322 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
module Saml
module Kit
module Cli
module Commands
class Metadata < Thor
desc 'register url', 'Registers the Metadata from the remote url.'
def register(url)
say registry.register_url(url).to_xml(pretty: true), :green
end
desc 'list', "List each of the registered entityId's"
def list
if registry.count.zero?
say('Register metadata using `saml-kit metadata register <url>`')
end
registry.each do |x|
say x.entity_id, :green
end
end
desc 'show entity_id', 'show the metadata associated with an entityId'
def show(entity_id)
metadata = registry.metadata_for(entity_id)
if metadata
Report.new(metadata).print(self)
else
say "`#{entity_id}` is not registered", :red
end
end
private
def registry
Saml::Kit.registry
end
end
end
end
end
end
|