Sha256: 27c397495f939d3689feabdd647c4fd14c1bcf880e05f995a619eaa1dfb29ffb

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

module Saml
  module Kit
    module Builders
      # {include:file:lib/saml/kit/builders/templates/logout_request.builder}
      # {include:file:spec/saml/builders/logout_request_spec.rb}
      class LogoutRequest
        include XmlTemplatable
        attr_accessor :id, :destination, :issuer, :name_id_format, :now
        attr_accessor :version
        attr_reader :user, :configuration

        def initialize(user, configuration: Saml::Kit.configuration)
          @configuration = configuration
          @user = user
          @id = ::Xml::Kit::Id.generate
          @issuer = configuration.entity_id
          @name_id_format = Saml::Kit::Namespaces::PERSISTENT
          @now = Time.now.utc
          @version = '2.0'
        end

        def build
          Saml::Kit::LogoutRequest.new(to_xml, configuration: configuration)
        end

        private

        def logout_request_options
          {
            ID: id,
            Version: version,
            IssueInstant: now.utc.iso8601,
            Destination: destination,
            xmlns: Namespaces::PROTOCOL,
          }
        end

        def name_id_options
          {
            Format: name_id_format,
            xmlns: Namespaces::ASSERTION,
          }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
saml-kit-1.0.9 lib/saml/kit/builders/logout_request.rb
saml-kit-1.0.8 lib/saml/kit/builders/logout_request.rb
saml-kit-1.0.7 lib/saml/kit/builders/logout_request.rb