Class: Saml::Kit::CompositeMetadata

Inherits:
Metadata
  • Object
show all
Includes:
Enumerable
Defined in:
lib/saml/kit/composite_metadata.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Metadata

Metadata::METADATA_XSD, Metadata::NAMESPACES

Instance Attribute Summary collapse

Attributes inherited from Metadata

#name

Instance Method Summary collapse

Methods inherited from Metadata

#contact_person_company, #encryption_certificates, #entity_id, from, #logout_request_for, #matches?, #name_id_formats, #organization_name, #organization_url, #service_for, #signing_certificates, #single_logout_service_for, #single_logout_services, #to_h, #to_s, #to_xml, #verify

Constructor Details

#initialize(xml) ⇒ CompositeMetadata

Returns a new instance of CompositeMetadata.



7
8
9
10
11
12
13
# File 'lib/saml/kit/composite_metadata.rb', line 7

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/saml/kit/composite_metadata.rb', line 32

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

Instance Attribute Details

#identity_providerObject (readonly)

Returns the value of attribute identity_provider.



5
6
7
# File 'lib/saml/kit/composite_metadata.rb', line 5

def identity_provider
  @identity_provider
end

#service_providerObject (readonly)

Returns the value of attribute service_provider.



5
6
7
# File 'lib/saml/kit/composite_metadata.rb', line 5

def service_provider
  @service_provider
end

Instance Method Details

#certificatesObject



24
25
26
# File 'lib/saml/kit/composite_metadata.rb', line 24

def certificates
  flat_map(&:certificates)
end

#each(&block) ⇒ Object



28
29
30
# File 'lib/saml/kit/composite_metadata.rb', line 28

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

#services(type) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/saml/kit/composite_metadata.rb', line 15

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