Class: Saml::Kit::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/core_ext/signature.rb

Constant Summary collapse

TABLE =
{
  'Digest Value' => ->(x) { x.digest_value },
  'Expected Digest Value' => ->(x) { x.expected_digest_value },
  'Digest Method' => ->(x) { x.digest_method },
  'Signature Value' => ->(x) { x.truncate(x.signature_value) },
  'Signature Method' => ->(x) { x.signature_method },
  'Canonicalization Method' => ->(x) { x.canonicalization_method },
}.freeze

Instance Method Summary collapse

Instance Method Details

#build_table(table = []) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/saml/kit/core_ext/signature.rb', line 15

def build_table(table = [])
  return table unless present?
  TABLE.each do |key, callable|
    table.push([key, callable.call(self)])
  end
  table.push(['', certificate.x509.to_text]) if certificate
end

#truncate(text, max: 50) ⇒ Object



23
24
25
# File 'lib/saml/kit/core_ext/signature.rb', line 23

def truncate(text, max: 50)
  text.length >= max ? "#{text[0..max]}..." : text
end