Sha256: f24e56957198cf0e440b5a0a55a274987a4793c13e9cb111a3f582a720206733

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    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 encrypt_with(key_pair)
        self.encrypt = true
        self.encryption_certificate = key_pair.certificate
      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

1 entries across 1 versions & 1 rubygems

Version Path
saml-kit-1.0.11 lib/saml/kit/xml_templatable.rb