Sha256: 817a68055457177f9b36da98950ab93012d53f3372b71aa0b15eee14de452863

Contents?: true

Size: 1.89 KB

Versions: 22

Compression:

Stored size: 1.89 KB

Contents

module Saml
  module ComplexTypes
    module SSODescriptorType
      extend ActiveSupport::Concern
      include Saml::Base

      class ArtifactResolutionService
        include Saml::ComplexTypes::IndexedEndpointType

        tag 'ArtifactResolutionService'
        namespace 'md'
      end

      class SingleLogoutService
        include Saml::ComplexTypes::EndpointType

        tag 'SingleLogoutService'
        namespace 'md'
      end

      included do
        namespace 'md'

        PROTOCOL_SUPPORT_ENUMERATION = "urn:oasis:names:tc:SAML:2.0:protocol" unless defined?(PROTOCOL_SUPPORT_ENUMERATION)

        attribute :protocol_support_enumeration, String, :tag => "protocolSupportEnumeration"
        attribute :valid_until, Time, :tag => "validUntil"
        attribute :cache_duration, String, :tag => "cacheDuration"
        attribute :error_url, String, :tag => "errorURL"

        has_many :key_descriptors, Saml::Elements::KeyDescriptor

        has_many :artifact_resolution_services, ArtifactResolutionService
        has_many :single_logout_services, SingleLogoutService

        validates :protocol_support_enumeration, :presence => true, :inclusion => [PROTOCOL_SUPPORT_ENUMERATION]
      end

      def initialize(*args)
        super(*args)
        @single_logout_services       ||= []
        @key_descriptors              ||= []
        @artifact_resolution_services ||= []
        @protocol_support_enumeration ||= PROTOCOL_SUPPORT_ENUMERATION
      end

      def find_key_descriptor(key_name, use)
        key_descriptors_by_use = find_key_descriptors_by_use(use)

        if key_name.present?
          key_descriptors_by_use.find { |key| key.key_info.key_name == key_name }
        else
          key_descriptors_by_use.first
        end
      end

      private

      def find_key_descriptors_by_use(use)
        key_descriptors.select { |key| key.use == use || key.use == "" }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
libsaml-2.5.1 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.5.0 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.7 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.6 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.5 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.4 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.3 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.2 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.4.1 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.3.2 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.3.1 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.2.3 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.2.2 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.2.1 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.9 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.8 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.7 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.6 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.5 lib/saml/complex_types/sso_descriptor_type.rb
libsaml-2.1.4 lib/saml/complex_types/sso_descriptor_type.rb