Sha256: 8756a7f9b5c6bf4bbbf712da56880e241d5a285b48aa737728c7f6cdce36dfbc

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module Saml
  module Kit
    module Builders
      # {include:file:spec/saml/builders/logout_request_spec.rb}
      class LogoutRequest
        include Saml::Kit::Templatable
        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 = "_#{SecureRandom.uuid}"
          @issuer = configuration.issuer
          @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

2 entries across 2 versions & 1 rubygems

Version Path
saml-kit-0.3.0 lib/saml/kit/builders/logout_request.rb
saml-kit-0.2.18 lib/saml/kit/builders/logout_request.rb