Sha256: 3ebd3ed62d5e6e5f2c9cb81a36fb606e2448d8f334b9451ae34843f382f1a56f

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    class Metadata
      TABLE = {
        'Entity Id' => ->(x) { x.entity_id },
        'Type' => ->(x) { x.name },
        'Valid' => ->(x) { x.valid? },
        'Name Id Formats' => ->(x) { x.name_id_formats.inspect },
        'Organization' => ->(x) { x.organization_name },
        'Url' => ->(x) { x.organization_url },
        'Contact' => ->(x) { x.contact_person_company },
      }.freeze

      SERVICES = %w[
        SingleSignOnService
        SingleLogoutService
        AssertionConsumerService
      ].freeze

      def build_table(table = [])
        TABLE.each { |key, callable| table.push([key, callable.call(self)]) }
        build_services_table(table)
        certificates.each do |certificate|
          table.push(['', certificate.x509.to_text])
        end
        signature.build_table(table)
      end

      def build_services_table(table)
        SERVICES.each do |type|
          services(type).each do |service|
            table.push([type, [service.location, service.binding]])
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saml-kit-cli-0.3.8 lib/saml/kit/core_ext/metadata.rb
saml-kit-cli-0.3.7 lib/saml/kit/core_ext/metadata.rb