Module: Saml::Kit::XmlTemplatable

Overview

This module is responsible for generating converting templates to xml.

Constant Summary collapse

TEMPLATES_DIR =
Pathname.new(File.join(__dir__, 'builders/templates/'))

Instance Method Summary collapse

Instance Method Details

#digest_methodObject



26
27
28
# File 'lib/saml/kit/xml_templatable.rb', line 26

def digest_method
  configuration.digest_method
end

#sign?Boolean

Returns true if an embedded signature is requested and at least one signing certificate is available via the configuration.

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/saml/kit/xml_templatable.rb', line 20

def sign?
  return configuration.sign? if embed_signature.nil?
  (embed_signature && configuration.sign?) ||
    (embed_signature && signing_key_pair.present?)
end

#signature_methodObject



30
31
32
# File 'lib/saml/kit/xml_templatable.rb', line 30

def signature_method
  configuration.signature_method
end

#signing_key_pairObject



34
35
36
# File 'lib/saml/kit/xml_templatable.rb', line 34

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

#template_nameObject



15
16
17
# File 'lib/saml/kit/xml_templatable.rb', line 15

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

#template_pathObject



11
12
13
# File 'lib/saml/kit/xml_templatable.rb', line 11

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