Sha256: 6755765e03960fa95705e8d69bbfee7531d98903ba453cc0ee1047689b895b82

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

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

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

        def build
          Saml::Kit::AuthenticationRequest.new(to_xml)
        end

        private

        def request_options
          options = {
            "xmlns:samlp" => Namespaces::PROTOCOL,
            "xmlns:saml" => Namespaces::ASSERTION,
            ID: id,
            Version: version,
            IssueInstant: now.utc.iso8601,
            Destination: destination,
          }
          if assertion_consumer_service_url.present?
            options[:AssertionConsumerServiceURL] = assertion_consumer_service_url
          end
          options
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
saml-kit-1.0.6 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.5 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.4 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.3 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.2 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.1 lib/saml/kit/builders/authentication_request.rb
saml-kit-1.0.0 lib/saml/kit/builders/authentication_request.rb