Sha256: c7e3f95e3af1ddef5b53490ce6f32eae51841dbb48886c654086b73c42195de8

Contents?: true

Size: 1.07 KB

Versions: 9

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

9 entries across 9 versions & 1 rubygems

Version Path
saml-kit-1.0.24 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.23 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.22 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.21 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.20 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.19 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.18 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.17 lib/saml/kit/concerns/xml_templatable.rb
saml-kit-1.0.16 lib/saml/kit/concerns/xml_templatable.rb