Sha256: 87eb8c7caa5f03e95d83238d2b66a1c6883f30cf06c5140e682d7ea9566f7ae7

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

module Saml
  module Kit
    module Builders
      # {include:file:spec/saml/builders/metadata_spec.rb}
      class Metadata
        include Templatable

        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 = Id.generate
          @entity_id = configuration.issuer
          @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': Namespaces::XMLDSIG,
            'xmlns:saml': Namespaces::ASSERTION,
            ID: id,
            entityID: entity_id,
          }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saml-kit-0.3.0 lib/saml/kit/builders/metadata.rb
saml-kit-0.2.18 lib/saml/kit/builders/metadata.rb