Sha256: b07e7d0838306ff22d8043b141e9d24c4604b74c57ce0c930dd30e3ae2b71053
Contents?: true
Size: 1.58 KB
Versions: 18
Compression:
Stored size: 1.58 KB
Contents
# frozen_string_literal: true module Saml module Kit # This class implements the Composite # design pattern to allow client # component to work with a metadata # that provides an IDPSSODescriptor # and SPSSODescriptor element. class CompositeMetadata < Metadata # :nodoc: 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 organization find { |x| x.organization.present? }.try(:organization) end def organization_name organization.name end def organization_url organization.url end def services(type) xpath = map do |x| "//md:EntityDescriptor/md:#{x.name}/md:#{type}" end.join('|') search(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 def respond_to_missing?(method, *) find { |x| x.respond_to?(method) } end end end end
Version data entries
18 entries across 18 versions & 1 rubygems