Sha256: f30fcc1452612bcfd2aa6be70bd14eb450e1bb5cdf9736a4e290ceb5a58d602c

Contents?: true

Size: 1.95 KB

Versions: 11

Compression:

Stored size: 1.95 KB

Contents

module Saml
  module Kit
    module Builders
      class IdentityProviderMetadata
        include Saml::Kit::Templatable
        extend Forwardable
        attr_accessor :attributes, :name_id_formats
        attr_accessor :want_authn_requests_signed
        attr_reader :logout_urls, :single_sign_on_urls
        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)
          @attributes = []
          @configuration = configuration
          @entity_id = configuration.issuer
          @id = Id.generate
          @logout_urls = []
          @name_id_formats = [Namespaces::PERSISTENT]
          @single_sign_on_urls = []
          @want_authn_requests_signed = true
          @metadata = Saml::Kit::Builders::Metadata.new(configuration: configuration)
          @metadata.identity_provider = self
        end

        def add_single_sign_on_service(url, binding: :http_post)
          @single_sign_on_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::IdentityProviderMetadata.new(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

        def descriptor_options
          {
            WantAuthnRequestsSigned: want_authn_requests_signed,
            protocolSupportEnumeration: Namespaces::PROTOCOL,
          }
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
saml-kit-0.2.17 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.16 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.15 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.14 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.13 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.12 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.11 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.10 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.9 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.8 lib/saml/kit/builders/identity_provider_metadata.rb
saml-kit-0.2.7 lib/saml/kit/builders/identity_provider_metadata.rb