Class: Saml::Kit::CompositeMetadata
- Inherits:
-
Metadata
- Object
- Metadata
- Saml::Kit::CompositeMetadata
show all
- 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
XsdValidatable::METADATA_XSD, XsdValidatable::PROTOCOL_XSD
XmlParseable::NAMESPACES
Instance Attribute Summary collapse
Attributes inherited from Metadata
#content, #name
Instance Method Summary
collapse
Methods inherited from Metadata
builder_class, #contact_person_company, #encryption_certificates, #entity_id, from, #logout_request_for, #matches?, #name_id_formats, #service_for, #signature, #signing_certificates, #single_logout_service_for, #single_logout_services, #verify
#present?, #to_h, #to_s, #to_xhtml, #to_xml
#each_error
Constructor Details
15
16
17
18
19
20
21
|
# File 'lib/saml/kit/composite_metadata.rb', line 15
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, **kwargs) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/saml/kit/composite_metadata.rb', line 54
def method_missing(name, *args, **kwargs)
if (target = find { |x| x.respond_to?(name) })
target.public_send(name, *args, **kwargs)
else
super
end
end
|
Instance Attribute Details
#identity_provider ⇒ Object
Returns the value of attribute identity_provider.
13
14
15
|
# File 'lib/saml/kit/composite_metadata.rb', line 13
def identity_provider
@identity_provider
end
|
#service_provider ⇒ Object
Returns the value of attribute service_provider.
13
14
15
|
# File 'lib/saml/kit/composite_metadata.rb', line 13
def service_provider
@service_provider
end
|
Instance Method Details
#certificates ⇒ Object
46
47
48
|
# File 'lib/saml/kit/composite_metadata.rb', line 46
def certificates
flat_map(&:certificates)
end
|
#each(&block) ⇒ Object
50
51
52
|
# File 'lib/saml/kit/composite_metadata.rb', line 50
def each(&block)
@metadatum.each(&block)
end
|
#organization ⇒ Object
23
24
25
|
# File 'lib/saml/kit/composite_metadata.rb', line 23
def organization
find { |x| x.organization.present? }.try(:organization)
end
|
#organization_name ⇒ Object
27
28
29
|
# File 'lib/saml/kit/composite_metadata.rb', line 27
def organization_name
organization.name
end
|
#organization_url ⇒ Object
31
32
33
|
# File 'lib/saml/kit/composite_metadata.rb', line 31
def organization_url
organization.url
end
|
#respond_to_missing?(method) ⇒ Boolean
62
63
64
|
# File 'lib/saml/kit/composite_metadata.rb', line 62
def respond_to_missing?(method, *)
find { |x| x.respond_to?(method) }
end
|
#services(type) ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/saml/kit/composite_metadata.rb', line 35
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
|