Class: SAML2::ServiceProvider

Inherits:
SSO show all
Defined in:
lib/saml2/service_provider.rb

Instance Attribute Summary

Attributes inherited from Role

#fingerprints, #keys, #private_keys, #supported_protocols

Attributes included from OrganizationAndContacts

#contacts, #organization

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from SSO

#name_id_formats, #single_logout_services

Methods inherited from Role

#encryption_keys, #signing_keys

Methods included from Signable

#sign, #signature, #signed?, #signing_key, #valid_signature?, #validate_signature

Methods inherited from Base

#decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initializeServiceProvider

Returns a new instance of ServiceProvider.



10
11
12
13
14
# File 'lib/saml2/service_provider.rb', line 10

def initialize
  super
  @assertion_consumer_services = Endpoint::Indexed::Array.new
  @attribute_consuming_services = AttributeConsumingService::Array.new
end

Instance Method Details

#assertion_consumer_servicesEndpoint::Indexed::Array



24
25
26
27
28
29
# File 'lib/saml2/service_provider.rb', line 24

def assertion_consumer_services
  @assertion_consumer_services ||= begin
    nodes = xml.xpath('md:AssertionConsumerService', Namespaces::ALL)
    Endpoint::Indexed::Array.from_xml(nodes)
  end
end

#attribute_consuming_servicesAttributeConsumingService::Array



32
33
34
35
36
37
# File 'lib/saml2/service_provider.rb', line 32

def attribute_consuming_services
  @attribute_consuming_services ||= begin
    nodes = xml.xpath('md:AttributeConsumingService', Namespaces::ALL)
    AttributeConsumingService::Array.from_xml(nodes)
  end
end

#build(builder) ⇒ void

This method returns an undefined value.

Serialize this object to XML, as part of a larger document

Parameters:

  • builder (Nokogiri::XML::Builder)

    The builder helper object to serialize to.



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/saml2/service_provider.rb', line 40

def build(builder)
  builder['md'].SPSSODescriptor do |sp_sso_descriptor|
    super(sp_sso_descriptor)

    assertion_consumer_services.each do |acs|
      acs.build(sp_sso_descriptor, 'AssertionConsumerService')
    end

    attribute_consuming_services.each do |acs|
      acs.build(sp_sso_descriptor)
    end
  end
end

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)


17
18
19
20
21
# File 'lib/saml2/service_provider.rb', line 17

def from_xml(node)
  super
  @assertion_consumer_services = nil
  @attribute_consuming_services = nil
end