Sha256: dd251dc80665a01991f2423917e4c13ed304ce91a1ede8e36cbb8d90bf8e55f3

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

module Saml
  module Kit
    module Builders
      class Assertion
        include Templatable
        extend Forwardable

        def_delegators :@response_builder, :encrypt, :embed_signature, :request, :issuer, :reference_id, :now, :configuration, :user, :version, :destination, :encryption_certificate

        def initialize(response_builder)
          @response_builder = response_builder
        end

        def name_id_format
          request.name_id_format
        end

        def name_id
          user.name_id_for(name_id_format)
        end

        def assertion_attributes
          user.assertion_attributes_for(request)
        end

        private

        def assertion_options
          {
            ID: reference_id,
            IssueInstant: now.iso8601,
            Version: version,
            xmlns: Namespaces::ASSERTION,
          }
        end

        def subject_confirmation_data_options
          {
            InResponseTo: request.id,
            NotOnOrAfter: 3.hours.since(now).utc.iso8601,
            Recipient: destination,
          }
        end

        def conditions_options
          {
            NotBefore: now.utc.iso8601,
            NotOnOrAfter: configuration.session_timeout.from_now.utc.iso8601,
          }
        end

        def authn_statement_options
          {
            AuthnInstant: now.iso8601,
            SessionIndex: reference_id,
            SessionNotOnOrAfter: 3.hours.since(now).utc.iso8601,
          }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saml-kit-0.2.11 lib/saml/kit/builders/assertion.rb
saml-kit-0.2.10 lib/saml/kit/builders/assertion.rb
saml-kit-0.2.9 lib/saml/kit/builders/assertion.rb
saml-kit-0.2.8 lib/saml/kit/builders/assertion.rb
saml-kit-0.2.7 lib/saml/kit/builders/assertion.rb