Sha256: 78bff35f88fcfc459824b5618dff1f14854fd6781a8f0b4d6bba5dd6cf7fb206

Contents?: true

Size: 774 Bytes

Versions: 9

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

module Saml
  module Kit
    # This module is responsible for validating
    # xml documents against the SAML XSD's
    module XsdValidatable
      PROTOCOL_XSD = File.expand_path(
        '../xsd/saml-schema-protocol-2.0.xsd', File.dirname(__FILE__)
      ).freeze

      METADATA_XSD = File.expand_path(
        '../xsd/saml-schema-metadata-2.0.xsd', File.dirname(__FILE__)
      ).freeze

      # @!visibility private
      def matches_xsd?(xsd)
        return unless to_nokogiri.present?

        Dir.chdir(File.dirname(xsd)) do
          xsd = Nokogiri::XML::Schema(IO.read(xsd))
          xsd.validate(to_nokogiri.document).each do |error|
            errors[:base] << error.message
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
saml-kit-1.1.0 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.31 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.30 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.29 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.28 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.27 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.26 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.25 lib/saml/kit/concerns/xsd_validatable.rb
saml-kit-1.0.24 lib/saml/kit/concerns/xsd_validatable.rb