Sha256: a18c7605b7afb0f22076c1237f548d93fc55a1179490551dba1ed6a1cf017ca9

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    # This module is responsible for
    # generating converting templates to xml.
    module XmlTemplatable
      TEMPLATES_DIR = Pathname.new(File.join(__dir__, '../builders/templates/'))
      include ::Xml::Kit::Templatable

      def template_path
        @template_path ||= TEMPLATES_DIR.join(template_name)
      end

      def template_name
        "#{self.class.name.split('::').last.underscore}.builder"
      end

      # Returns true if an embedded signature is requested and at least one
      # signing certificate is available via the configuration.
      def sign?
        return configuration.sign? if embed_signature.nil?

        (embed_signature && configuration.sign?) ||
          (embed_signature && signing_key_pair.present?)
      end

      def digest_method
        configuration.digest_method
      end

      def signature_method
        configuration.signature_method
      end

      def signing_key_pair
        @signing_key_pair || configuration.key_pairs(use: :signing).last
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.2.0 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.1.0 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.31 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.30 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.29 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.28 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.27 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.26 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.25 lib/saml/kit/concerns/xml_templatable.rb