Sha256: 026acb32ab611f2641780dd67d98773c354db335e0c97a69c2952f664c16bd33

Contents?: true

Size: 1.54 KB

Versions: 19

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    module Builders
      # {include:file:lib/saml/kit/builders/templates/metadata.builder}
      # {include:file:spec/saml/kit/builders/metadata_spec.rb}
      class Metadata
        include XmlTemplatable

        attr_accessor :entity_id
        attr_accessor :id
        attr_accessor :identity_provider
        attr_accessor :organization_name, :organization_url, :contact_email
        attr_accessor :service_provider
        attr_reader :configuration

        def initialize(configuration: Saml::Kit.configuration)
          @id = ::Xml::Kit::Id.generate
          @entity_id = configuration.entity_id
          @configuration = configuration
        end

        def build_service_provider
          @service_provider = Saml::Kit::ServiceProviderMetadata.builder(
            configuration: configuration
          ) do |x|
            yield x if block_given?
          end
        end

        def build_identity_provider
          @identity_provider = Saml::Kit::IdentityProviderMetadata.builder(
            configuration: configuration
          ) do |x|
            yield x if block_given?
          end
        end

        def build
          Saml::Kit::Metadata.from(to_xml)
        end

        private

        def entity_descriptor_options
          {
            'xmlns': Namespaces::METADATA,
            'xmlns:ds': ::Xml::Kit::Namespaces::XMLDSIG,
            'xmlns:saml': Namespaces::ASSERTION,
            ID: id,
            entityID: entity_id,
          }
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/builders/metadata.rb
saml-kit-1.2.0 lib/saml/kit/builders/metadata.rb
saml-kit-1.1.0 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.31 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.30 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.29 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.28 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.27 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.26 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.25 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.24 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.23 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.22 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.21 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.20 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.19 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.18 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.17 lib/saml/kit/builders/metadata.rb
saml-kit-1.0.16 lib/saml/kit/builders/metadata.rb