Sha256: fc9339c4fafae86e270ada5d944ac190f14b73681eac07f9040d73ed0bc5a27e

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

module Saml
  module Kit
    class CompositeMetadata < Metadata
      include Enumerable
      attr_reader :service_provider, :identity_provider

      def initialize(xml)
        super("IDPSSODescriptor", xml)
        @metadatum = [
          Saml::Kit::ServiceProviderMetadata.new(xml),
          Saml::Kit::IdentityProviderMetadata.new(xml),
        ]
      end

      def services(type)
        xpath = map { |x| "//md:EntityDescriptor/md:#{x.name}/md:#{type}" }.join("|")
        document.find_all(xpath).map do |item|
          binding = item.attribute("Binding").value
          location = item.attribute("Location").value
          Saml::Kit::Bindings.create_for(binding, location)
        end
      end

      def certificates
        flat_map(&:certificates)
      end

      def each(&block)
        @metadatum.each(&block)
      end

      def method_missing(name, *args)
        if target = find { |x| x.respond_to?(name) }
          target.public_send(name, *args)
        else
          super
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
saml-kit-0.2.11 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.10 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.9 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.8 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.7 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.6 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.5 lib/saml/kit/composite_metadata.rb
saml-kit-0.2.4 lib/saml/kit/composite_metadata.rb