summaryrefslogtreecommitdiff
path: root/lib/saml/kit/cli/metadata.rb
blob: e85263cf447c64be848e97b1de748692e90513b4 (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
module Saml
  module Kit
    module Cli
      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
          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)
          say registry.metadata_for(entity_id).to_xml(pretty: true), :green
        end

        private

        def registry
          Saml::Kit.registry
        end
      end
    end
  end
end