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


28
29
30
# File 'lib/saml/kit/concerns/xml_templatable.rb', line 28

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)

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

def sign?
  return configuration.sign? if embed_signature.nil?

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

#signature_methodObject


32
33
34
# File 'lib/saml/kit/concerns/xml_templatable.rb', line 32

def signature_method
  configuration.signature_method
end

#signing_key_pairObject


36
37
38
# File 'lib/saml/kit/concerns/xml_templatable.rb', line 36

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

#template_nameObject


15
16
17
# File 'lib/saml/kit/concerns/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/concerns/xml_templatable.rb', line 11

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