Class: Saml::Kit::ServiceProviderMetadata

Inherits:
Metadata
  • Object
show all
Defined in:
lib/saml/kit/service_provider_metadata.rb

Overview

This class represents a SPSSODescriptor element in a SAML metadata document.

Constant Summary

Constants included from XsdValidatable

XsdValidatable::METADATA_XSD, XsdValidatable::PROTOCOL_XSD

Constants included from XmlParseable

XmlParseable::NAMESPACES

Instance Attribute Summary

Attributes inherited from Metadata

#content, #name

Instance Method Summary collapse

Methods inherited from Metadata

#certificates, #contact_person_company, #encryption_certificates, #entity_id, from, #logout_request_for, #matches?, #name_id_formats, #organization, #organization_name, #organization_url, #service_for, #services, #signature, #signing_certificates, #single_logout_service_for, #single_logout_services, #verify

Methods included from XmlParseable

#present?, #to_h, #to_s, #to_xhtml, #to_xml

Constructor Details

#initialize(xml) ⇒ ServiceProviderMetadata


10
11
12
# File 'lib/saml/kit/service_provider_metadata.rb', line 10

def initialize(xml)
  super('SPSSODescriptor', xml)
end

Instance Method Details

#assertion_consumer_service_for(binding:) ⇒ Object

Returns the AssertionConsumerService for the specified binding.


22
23
24
# File 'lib/saml/kit/service_provider_metadata.rb', line 22

def assertion_consumer_service_for(binding:)
  service_for(binding: binding, type: 'AssertionConsumerService')
end

#assertion_consumer_servicesObject

Returns each of the AssertionConsumerService bindings.


15
16
17
# File 'lib/saml/kit/service_provider_metadata.rb', line 15

def assertion_consumer_services
  services('AssertionConsumerService')
end

#want_assertions_signedObject

Returns true when the metadata demands that Assertions must be signed.


27
28
29
30
31
32
33
# File 'lib/saml/kit/service_provider_metadata.rb', line 27

def want_assertions_signed
  element = at_xpath("/md:EntityDescriptor/md:#{name}")
  attribute = element.attribute('WantAssertionsSigned')
  return true if attribute.nil?

  attribute.text.casecmp('true').zero?
end