Sha256: ea7930e3b637882004deddad8354a9da4701ef9010f27d90db6b99d5de8dab31

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require 'nokogiri'

require 'saml2/endpoint'
require 'saml2/sso'

module SAML2
  class ServiceProvider < SSO
    def initialize
      super
      @assertion_consumer_services = []
      @attribute_consuming_services = []
    end

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

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

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

    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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saml2-1.1.3 lib/saml2/service_provider.rb
saml2-1.1.2 lib/saml2/service_provider.rb
saml2-1.1.1 lib/saml2/service_provider.rb
saml2-1.1.0 lib/saml2/service_provider.rb