Sha256: 39726020246f2d398bd997c975377698cc213ae798ede3e777679a6cdda8c8d2

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    # This class represents a
    # SPSSODescriptor element in a
    # SAML metadata document.
    # {include:file:spec/examples/service_provider_metadata_spec.rb}
    class ServiceProviderMetadata < Metadata
      def initialize(xml)
        super('SPSSODescriptor', xml)
      end

      # Returns each of the AssertionConsumerService bindings.
      def assertion_consumer_services
        services('AssertionConsumerService')
      end

      # Returns the AssertionConsumerService for the specified binding.
      #
      # @param binding [Symbol] can be either `:http_post` or `:http_redirect`
      def assertion_consumer_service_for(binding:)
        service_for(binding: binding, type: 'AssertionConsumerService')
      end

      # Returns true when the metadata demands that Assertions must be signed.
      def want_assertions_signed
        element = at_xpath("/md:EntityDescriptor/md:#{name}")
        attribute = element.attribute('WantAssertionsSigned')
        return true if attribute.nil?

        attribute.text.casecmp('true').zero?
      end

      # @!visibility private
      def self.builder_class
        Saml::Kit::Builders::ServiceProviderMetadata
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.2.0 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.1.0 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.31 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.30 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.29 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.28 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.27 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.26 lib/saml/kit/service_provider_metadata.rb
saml-kit-1.0.25 lib/saml/kit/service_provider_metadata.rb