Sha256: d9e0417d038ba64916956846b499a3ed4d108fd9659dd19e9210f79d3d7c2da1

Contents?: true

Size: 1.87 KB

Versions: 16

Compression:

Stored size: 1.87 KB

Contents

module Saml
  module Kit
    module Builders
      # {include:file:lib/saml/kit/builders/templates/service_provider_metadata.builder}
      # {include:file:spec/saml/builders/service_provider_metadata_spec.rb}
      class ServiceProviderMetadata
        include XmlTemplatable
        extend Forwardable
        attr_accessor :acs_urls, :logout_urls, :name_id_formats
        attr_accessor :want_assertions_signed
        attr_reader :configuration
        attr_reader :metadata
        def_delegators :metadata, :id, :id=, :entity_id, :entity_id=, :organization_name, :organization_name=, :organization_url, :organization_url=, :contact_email, :contact_email=, :to_xml

        def initialize(configuration: Saml::Kit.configuration)
          @acs_urls = []
          @configuration = configuration
          @logout_urls = []
          @name_id_formats = [Namespaces::PERSISTENT]
          @want_assertions_signed = true
          @metadata = Saml::Kit::Builders::Metadata.new(configuration: configuration)
          @metadata.service_provider = self
        end

        def add_assertion_consumer_service(url, binding: :http_post)
          @acs_urls.push(location: url, binding: Bindings.binding_for(binding))
        end

        def add_single_logout_service(url, binding: :http_post)
          @logout_urls.push(location: url, binding: Bindings.binding_for(binding))
        end

        def build
          Saml::Kit::ServiceProviderMetadata.new(to_xml)
        end

        private

        def entity_descriptor_options
          {
            'xmlns': Namespaces::METADATA,
            ID: id,
            entityID: entity_id,
          }
        end

        def descriptor_options
          {
            AuthnRequestsSigned: sign?,
            WantAssertionsSigned: want_assertions_signed,
            protocolSupportEnumeration: Namespaces::PROTOCOL,
          }
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
saml-kit-1.0.9 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.8 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.7 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.6 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.5 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.4 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.3 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.2 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.1 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-1.0.0 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.6 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.5 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.4 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.3 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.2 lib/saml/kit/builders/service_provider_metadata.rb
saml-kit-0.3.1 lib/saml/kit/builders/service_provider_metadata.rb