Sha256: d537c55174b804bd9c767e3a79706aa5d7f7db5ab7222ecac01b3062b28db1a9

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 KB

Contents

module Saml
  module Kit
    module Builders
      # {include:file:lib/saml/kit/builders/templates/assertion.builder}
      class Assertion
        include XmlTemplatable
        extend Forwardable

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

        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.since(now).utc.iso8601,
          }
        end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
saml-kit-1.0.2 lib/saml/kit/builders/assertion.rb
saml-kit-1.0.1 lib/saml/kit/builders/assertion.rb
saml-kit-1.0.0 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.6 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.5 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.4 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.3 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.2 lib/saml/kit/builders/assertion.rb
saml-kit-0.3.1 lib/saml/kit/builders/assertion.rb