summaryrefslogtreecommitdiff
path: root/lib/saml/kit/core_ext/assertion.rb
blob: 482386375415ac8ab744659a8c1ea6b74a67910f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Saml
  module Kit
    class Assertion
      TABLE = {
        'Assertion Present?' => ->(x) { x.present? },
        'Issuer' => ->(x) { x.issuer },
        'Name Id' => ->(x) { x.name_id },
        'Attributes' => ->(x) { x.attributes.inspect },
        'Not Before' => ->(x) { x.started_at },
        'Not After' => ->(x) { x.expired_at },
        'Audiences' => ->(x) { x.audiences.inspect },
        'Encrypted?' => ->(x) { x.encrypted? },
        'Decryptable' => ->(x) { x.decryptable? },
      }.freeze

      def build_table(table = [])
        TABLE.each do |key, callable|
          table.push([key, callable.call(self)])
        end
        signature.build_table(table)
      end
    end
  end
end