Class: Saml::Kit::CompositeMetadata
- Includes:
- Enumerable
- Defined in:
- lib/saml/kit/composite_metadata.rb
Overview
This class implements the Composite design pattern to allow client component to work with a metadata that provides an IDPSSODescriptor and SPSSODescriptor element.
Constant Summary
Constants inherited from Metadata
Metadata::METADATA_XSD, Metadata::NAMESPACES
Instance Attribute Summary collapse
-
#identity_provider ⇒ Object
readonly
Returns the value of attribute identity_provider.
-
#service_provider ⇒ Object
readonly
Returns the value of attribute service_provider.
Attributes inherited from Metadata
Instance Method Summary collapse
- #certificates ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(xml) ⇒ CompositeMetadata
constructor
A new instance of CompositeMetadata.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(method) ⇒ Boolean
- #services(type) ⇒ Object
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, #signature, #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.
14 15 16 17 18 19 20 |
# File 'lib/saml/kit/composite_metadata.rb', line 14 def initialize(xml) super('IDPSSODescriptor', xml) @metadatum = [ Saml::Kit::ServiceProviderMetadata.new(xml), Saml::Kit::IdentityProviderMetadata.new(xml), ] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/saml/kit/composite_metadata.rb', line 39 def method_missing(name, *args) if (target = find { |xxx| xxx.respond_to?(name) }) target.public_send(name, *args) else super end end |
Instance Attribute Details
#identity_provider ⇒ Object (readonly)
Returns the value of attribute identity_provider.
12 13 14 |
# File 'lib/saml/kit/composite_metadata.rb', line 12 def identity_provider @identity_provider end |
#service_provider ⇒ Object (readonly)
Returns the value of attribute service_provider.
12 13 14 |
# File 'lib/saml/kit/composite_metadata.rb', line 12 def service_provider @service_provider end |
Instance Method Details
#certificates ⇒ Object
31 32 33 |
# File 'lib/saml/kit/composite_metadata.rb', line 31 def certificates flat_map(&:certificates) end |
#each(&block) ⇒ Object
35 36 37 |
# File 'lib/saml/kit/composite_metadata.rb', line 35 def each(&block) @metadatum.each(&block) end |
#respond_to_missing?(method) ⇒ Boolean
47 48 49 |
# File 'lib/saml/kit/composite_metadata.rb', line 47 def respond_to_missing?(method, *) find { |xxx| xxx.respond_to?(method) } end |
#services(type) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/saml/kit/composite_metadata.rb', line 22 def services(type) xpath = map { |xxx| "//md:EntityDescriptor/md:#{xxx.name}/md:#{type}" }.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 |