Sha256: 8087f5ceaf9fe9075c9138de78fb030d911e5503421453b82cad604efab74516

Contents?: true

Size: 1.69 KB

Versions: 6

Compression:

Stored size: 1.69 KB

Contents

module Saml
  module Kit
    module Builders
      class AuthenticationRequest
        include Saml::Kit::Templatable
        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 = Id.generate
          @issuer = configuration.issuer
          @name_id_format = Namespaces::PERSISTENT
          @now = Time.now.utc
          @version = "2.0"
        end

        # @deprecated Use {#assertion_consumer_service_url} instead of this method.
        def acs_url
          Saml::Kit.deprecate("acs_url is deprecated. Use assertion_consumer_service_url instead")
          self.assertion_consumer_service_url
        end

        # @deprecated Use {#assertion_consumer_service_url=} instead of this method.
        def acs_url=(value)
          Saml::Kit.deprecate("acs_url= is deprecated. Use assertion_consumer_service_url= instead")
          self.assertion_consumer_service_url = value
        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

6 entries across 6 versions & 1 rubygems

Version Path
saml-kit-0.2.17 lib/saml/kit/builders/authentication_request.rb
saml-kit-0.2.16 lib/saml/kit/builders/authentication_request.rb
saml-kit-0.2.15 lib/saml/kit/builders/authentication_request.rb
saml-kit-0.2.14 lib/saml/kit/builders/authentication_request.rb
saml-kit-0.2.13 lib/saml/kit/builders/authentication_request.rb
saml-kit-0.2.12 lib/saml/kit/builders/authentication_request.rb